public
Description: Rails Sitemap Plugin / Site Map Plugin for Rails. A beautiful rails sitemap plugin that talks to Google, Yahoo and MSN when updated. Sitemap features clean handcrafted XHTML, XML with XSLT and custom finder options for your named routes.
Clone URL: git://github.com/queso/sitemap.git
Search Repo:
First checkin of the sitemap plugin.
queso (author)
Thu Dec 13 09:21:20 -0800 2007
commit  f8c3d59b0bc4480e68ae9cdce296f940e3496ebc
tree    7f0d6cc707e44b5a665db2d634c21ecf7593046c
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
@@ -0,0 +1,20 @@
0
+Copyright (c) 2007 [name of plugin creator]
0
+
0
+Permission is hereby granted, free of charge, to any person obtaining
0
+a copy of this software and associated documentation files (the
0
+"Software"), to deal in the Software without restriction, including
0
+without limitation the rights to use, copy, modify, merge, publish,
0
+distribute, sublicense, and/or sell copies of the Software, and to
0
+permit persons to whom the Software is furnished to do so, subject to
0
+the following conditions:
0
+
0
+The above copyright notice and this permission notice shall be
0
+included in all copies or substantial portions of the Software.
0
+
0
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
0
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
0
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
0
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0
...
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
0
@@ -0,0 +1,13 @@
0
+Sitemap
0
+=======
0
+
0
+Introduction goes here.
0
+
0
+
0
+Example
0
+=======
0
+
0
+Example goes here.
0
+
0
+
0
+Copyright (c) 2007 [name of plugin creator], released under the MIT license
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0
@@ -0,0 +1,22 @@
0
+require 'rake'
0
+require 'rake/testtask'
0
+require 'rake/rdoctask'
0
+
0
+desc 'Default: run unit tests.'
0
+task :default => :test
0
+
0
+desc 'Test the sitemap plugin.'
0
+Rake::TestTask.new(:test) do |t|
0
+ t.libs << 'lib'
0
+ t.pattern = 'test/**/*_test.rb'
0
+ t.verbose = true
0
+end
0
+
0
+desc 'Generate documentation for the sitemap plugin.'
0
+Rake::RDocTask.new(:rdoc) do |rdoc|
0
+ rdoc.rdoc_dir = 'rdoc'
0
+ rdoc.title = 'Sitemap'
0
+ rdoc.options << '--line-numbers' << '--inline-source'
0
+ rdoc.rdoc_files.include('README')
0
+ rdoc.rdoc_files.include('lib/**/*.rb')
0
+end
...
 
 
0
...
1
2
3
0
@@ -0,0 +1,2 @@
0
+require 'sitemap'
0
+SitemapsController.view_paths = [File.join(directory, 'views')]
0
\ No newline at end of file
...
 
...
1
0
@@ -0,0 +1 @@
0
+# Install hook code here
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
0
@@ -0,0 +1,32 @@
0
+module Queso
0
+ module SEO
0
+
0
+ class ConfigFileNotFoundError < StandardError; end
0
+
0
+ class Sitemap
0
+ attr_accessor :sitemap_config
0
+
0
+ def initialize(file = '/config/sitemap.yml') #:nodoc:
0
+ begin
0
+ path = RAILS_ROOT + file
0
+ @sitemap_config = YAML.load_file(path).symbolize_keys
0
+ rescue
0
+ raise ConfigFileNotFoundError.new('File %s not found' % path )
0
+ end
0
+ end
0
+
0
+ def widgets
0
+ widgets = {}
0
+ sitemap_config.each_key do |k|
0
+ widgets[k] = find_widgets(sitemap_config[k]["model"].constantize)
0
+ end
0
+ widgets
0
+ end
0
+
0
+ def find_widgets(widget_model, options = {})
0
+ widget_model.find(:all, options)
0
+ end
0
+
0
+ end
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -0,0 +1,13 @@
0
+class SitemapsController < ActionController::Base
0
+ layout nil
0
+
0
+ def show
0
+ s = Queso::SEO::Sitemap.new
0
+ @widgets = s.widgets
0
+ @sitemap_config = s.sitemap_config
0
+ respond_to do |format|
0
+ format.xml {render :template => "show.xml.builder"}
0
+ end
0
+ end
0
+
0
+end
0
\ No newline at end of file
...
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
0
@@ -0,0 +1,7 @@
0
+module SitemapsHelper
0
+
0
+ def w3c_date(date)
0
+ date.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00")
0
+ end
0
+
0
+end
0
\ No newline at end of file
...
 
 
 
 
...
1
2
3
4
0
@@ -0,0 +1,4 @@
0
+# desc "Explaining what the task does"
0
+# task :sitemap do
0
+# # Task goes here
0
+# end
...
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
0
@@ -0,0 +1,8 @@
0
+require 'test/unit'
0
+
0
+class SitemapTest < Test::Unit::TestCase
0
+ # Replace this with your real tests.
0
+ def test_this_plugin
0
+ flunk
0
+ end
0
+end
...
 
...
1
0
@@ -0,0 +1 @@
0
+# Uninstall hook code here
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
0
@@ -0,0 +1,28 @@
0
+xml.instruct!
0
+
0
+xml.urlset "xmlns" => "http://www.google.com/schemas/sitemap/0.84" do
0
+ xml.url do
0
+ xml.loc url_for(root_url)
0
+ xml.lastmod w3c_date(Time.now)
0
+ xml.changefreq "always"
0
+ end
0
+
0
+@widgets.each_key do |k|
0
+ xml.url do
0
+ xml.loc url_for(send(@sitemap_config[k]["index_named_route"].to_sym))
0
+ xml.lastmod w3c_date(Time.now)
0
+ xml.changefreq @sitemap_config[k]["frequency_index"]
0
+ xml.priority @sitemap_config[k]["prioity"]
0
+ end
0
+
0
+ @widgets[k].each do |widget|
0
+ xml.url do
0
+ xml.loc polymorphic_url(widget)
0
+ xml.lastmod w3c_date(Time.now)
0
+ xml.changefreq @sitemap_config[k]["frequency_show"]
0
+ xml.priority @sitemap_config[k]["prioity"]
0
+ end
0
+ end
0
+end
0
+
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.