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
README
=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