bcms_seo_sitemap 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.markdown CHANGED
@@ -1,12 +1,56 @@
1
1
  #Sitemaps Module for BrowserCMS
2
2
 
3
3
  This is a simple module that generates a basic xml Sitemap for BrowserCMS
4
- projects. For each published page, it generates the <loc></loc> tag according to the [Sitemap
5
- protocol](http://www.sitemaps.org/protocol.php) but no metadata.
4
+ projects. For each published page, it generates the `loc` tag according to the [Sitemap
5
+ protocol](http://www.sitemaps.org/protocol.php), but no metadata.
6
6
 
7
7
  To determine which pages should be included in the Sitemap, it leverages
8
8
  BrowserCMS' menu_items helper. This means that hidden or unpublished pages will
9
- not be included.
9
+ not be included. Empty sections are also ignored.
10
10
 
11
11
  The xml document is exposed at /sitemaps/google.xml
12
12
 
13
+ ## Installation
14
+
15
+ The Seo Sitemap module installs like most other BrowserCMS modules (http://guides.browsercms.org/installing_modules.html)
16
+ but it does not require a database migration.
17
+
18
+ gem install bcms_seo_sitemap
19
+
20
+ ## Set up your application to use the module
21
+
22
+ ### 1. Edit config/environment.rb
23
+
24
+ config.gem "browsercms"
25
+ config.gem "bcms_seo_sitemap"
26
+
27
+ ### 2. Run the following commands
28
+
29
+ script/generate browser_cms
30
+
31
+ ### 3. Edit config/routes.rb
32
+
33
+ Make sure the routes.rb loads the sitemap routes.
34
+
35
+ map.routes_for_bcms_seo_sitemap
36
+ map.routes_for_browser_cms
37
+
38
+ ##Configuration
39
+
40
+ The module adds a new entry under Administration > Tools labeled XML Sitemaps
41
+ where the module can be configured.
42
+
43
+ At the moment, only the "depth" option is available, which is passed to the
44
+ menu_items helper method. Setting a depth of 2 will result in a call to menu_items
45
+ like this:
46
+
47
+ menu_items(:depth => 2, :show_all_siblings => true, :page => Page.find_by_path('/')
48
+
49
+ The module's configuration (currently just one value) is serialized to yaml and
50
+ kept in config/sitemap.yml. It is not necessary to create this file manually. It
51
+ will be created when needed.
52
+
53
+ A depth value of 0 (the default) will include all published pages.
54
+
55
+
56
+
@@ -1,6 +1,6 @@
1
1
  <% unless sitemap_item[:url] == "#" %>
2
2
  <url>
3
- <loc><%= "http://#{request.host}#{sitemap_item[:url]}" %></loc>
3
+ <loc><%= CGI.escapeHTML("http://#{request.host}#{sitemap_item[:url]}") %></loc>
4
4
  </url>
5
5
  <% unless sitemap_item[:children].blank? %>
6
6
  <% sitemap_item[:children].each do |item| %>
@@ -0,0 +1,14 @@
1
+ class CreateCmsModules < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :cms_modules do |t|
4
+ t.string :name, :limit => 50
5
+ t.text :settings
6
+ t.boolean :cms_managed, :default => true
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :cms_modules
12
+ end
13
+ end
14
+
@@ -3,33 +3,34 @@ module Cms
3
3
  extend self
4
4
  extend Cms::MenuHelper
5
5
 
6
- CONFIG_PATH = File.join(Rails.root, 'config', 'sitemap.yml')
7
-
8
6
  def items
9
7
  options = {:page => Page.find_by_path('/'), :show_all_siblings => true}
10
- options.merge!(configuration.symbolize_keys!)
11
- options.delete(:depth) if configuration[:depth].zero?
8
+ if configuration.depth && configuration.depth.nonzero?
9
+ options.merge!({:depth => configuration.depth})
10
+ end
12
11
  menu_items(options)
13
12
  end
14
13
 
14
+ # These setter and getter methods are probably not needed anymore.
15
+ # Access to Cms::Settings.bcms_seo_sitemap could be done directly
16
+ # from Cms::SitemapsController and that would probably be cleaner.
17
+ #
18
+ # I'm keeping them here to keep the changes contained to this file
19
+ # only for now.
15
20
  def depth=(new_depth)
16
- new_config = configuration.merge!({:depth => new_depth.to_i})
17
-
18
- File.open(CONFIG_PATH, 'w') do |out|
19
- YAML.dump(new_config, out)
20
- end
21
+ configuration.depth = new_depth.to_i
21
22
  end
22
23
 
24
+ # If depth has never been set, it returns nil
23
25
  def depth
24
- configuration[:depth] || 0
26
+ configuration.depth || 0
25
27
  end
26
28
 
27
29
  private
28
30
 
29
31
  def configuration
30
- YAML::load(File.open(CONFIG_PATH))
31
- rescue Errno::ENOENT
32
- {}
32
+ Cms::Settings.bcms_seo_sitemap
33
33
  end
34
34
  end
35
35
  end
36
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bcms_seo_sitemap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - BrowserMedia
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-24 00:00:00 -06:00
18
+ date: 2010-11-29 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,32 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 7
30
30
  segments:
31
- - 0
32
- version: "0"
33
- type: :development
31
+ - 3
32
+ - 1
33
+ - 2
34
+ version: 3.1.2
35
+ type: :runtime
34
36
  version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: bcms_settings
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 29
46
+ segments:
47
+ - 0
48
+ - 0
49
+ - 1
50
+ version: 0.0.1
51
+ type: :runtime
52
+ version_requirements: *id002
35
53
  description: This module generates XML Sitemaps for BrowserCMS Projects
36
54
  email: github@browsermedia.com
37
55
  executables: []
@@ -40,7 +58,6 @@ extensions: []
40
58
 
41
59
  extra_rdoc_files:
42
60
  - LICENSE.txt
43
- - README
44
61
  - README.markdown
45
62
  files:
46
63
  - app/controllers/application_controller.rb
@@ -54,13 +71,13 @@ files:
54
71
  - app/views/layouts/templates/default.html.erb
55
72
  - app/views/sitemaps/_sitemap_item.xml.erb
56
73
  - app/views/sitemaps/google.xml.erb
74
+ - db/migrate/20101129011429_create_cms_modules.rb
57
75
  - doc/README_FOR_APP
58
76
  - lib/bcms_seo_sitemap.rb
59
77
  - lib/bcms_seo_sitemap/cms/sitemap_generator.rb
60
78
  - lib/bcms_seo_sitemap/routes.rb
61
79
  - rails/init.rb
62
80
  - LICENSE.txt
63
- - README
64
81
  - README.markdown
65
82
  - test/functional/cms/sitemaps_controller_test.rb
66
83
  - test/functional/sitemaps_controller_test.rb
data/README DELETED
@@ -1,56 +0,0 @@
1
- #Sitemaps Module for BrowserCMS
2
-
3
- This is a simple module that generates a basic xml Sitemap for BrowserCMS
4
- projects. For each published page, it generates the <loc></loc> tag according to the [Sitemap
5
- protocol](http://www.sitemaps.org/protocol.php) but no metadata.
6
-
7
- To determine which pages should be included in the Sitemap, it leverages
8
- BrowserCMS' menu_items helper. This means that hidden or unpublished pages will
9
- not be included. Empty sections are also ignored.
10
-
11
- The xml document is exposed at /sitemaps/google.xml
12
-
13
- ## Installation
14
-
15
- The blog module installs like most other BrowserCMS modules (http://guides.browsercms.org/installing_modules.html)
16
- but it does not require a database migration.
17
-
18
- gem install bcms_seo_sitemap
19
-
20
- ## Set up your application to use the module
21
-
22
- ### 1. Edit config/environment.rb
23
-
24
- config.gem "browsercms"
25
- config.gem "bcms_seo_sitemap"
26
-
27
- ### 2. Run the following commands
28
-
29
- script/generate browser_cms
30
-
31
- ### 3. Edit config/routes.rb
32
-
33
- Make sure the routes.rb loads the sitemap routes.
34
-
35
- map.routes_for_bcms_seo_sitemap
36
- map.routes_for_browser_cms
37
-
38
- ##Configuration
39
-
40
- The module adds a new entry under Administration > Tools labeled XML Sitemaps
41
- where the module can be configured.
42
-
43
- At the moment, only the "depth" option is available, which is passed to the
44
- menu_items helper method. Setting a depth of 2 will result in a call to menu_items
45
- like this:
46
-
47
- menu_items(:depth => 2, :show_all_siblings => true, :page => Page.find_by_path('/')
48
-
49
- The module's configuration (currently just one value) is serialized to yaml and
50
- kept in config/sitemap.yml. It is not necessary to create this file manually. It
51
- will be created when needed.
52
-
53
- A depth value of 0 (the default) will include all published pages.
54
-
55
-
56
-