Gazer / has_sitemap

A Rails plugin to create sitemaps

This URL has Read+Write access

Gazer (author)
Sun Jun 22 12:37:58 -0700 2008
has_sitemap / README
100644 64 lines (43 sloc) 1.518 kb
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
=HasSitemap
 
This plugin allow your sites provide in an easy way sitemap and/or sitemaps index to
improve search engine indexing.
 
For more details about the sitemap protocol see [1]
 
=Example
 
For sitemap :
  controller MyController::ActiveController::Base
    has_sitemap :data => :my_func
 
    def index
    end
 
    # Others public methods
 
    private
    def my_func
      # Create sitemap array
    end
  end
 
The my_func function must return an array of hashes, where each hash contains the keys :
loc, lastmod, priority (optional), changefreq (optional). The changefreq must be a valid value
as described in [1].
 
The plugin add an aditional method to help in the array construction, called sitemap_entry.
See the docs for more details.
 
For sitemap_index :
  controller MyController::ActiveController::Base
    has_sitemap_index :data => :my_func
 
    def index
    end
 
    # Others public methods
 
    private
    def my_func
      # Create sitemap array
    end
  end
 
The value returned by my_func is the same as described for has_sitemap, with loc and loatmod (optional)
has keys for each item.
 
 
To access to your sitemap or sitemap_index just use :
  http://localhost:3000/my/sitemap.xml
  http://localhost:3000/my/sitemap_index.xml
 
=TODO
* A Sitemap can't have more than 50k entries, the plugnin have handle this for large sites
* GZipped sitemaps
 
=References
 
[1] http://www.sitemaps.org/protocol.php
 
Copyright (c) 2008 Ricardo Markiewcz <richard@3dgames.com.ar>, released under the MIT license