Skip to content

Latest commit

 

History

History
53 lines (33 loc) · 1.57 KB

README.textile

File metadata and controls

53 lines (33 loc) · 1.57 KB

XML Sitemap Generator for Rails

This is an approach to get the amazing XML Sitemap Generator for Wordpress to the rails world.

The plugin adds an after_save filter to the model which fires the generate_sitemap method provided by the plugin.
The sitemap is saved in the public folder as sitemap.xml and a gziped version sitemap.xml.gz.
The plugin informs Google by pinging the sitemap submit URL google provids (http://www.google.com/webmasters/tools/ping?sitemap=http://your-site.com/sitemap.xml.gz)

Install

script/plugin install git://github.com/fsmanuel/xml_sitemap_generator.git

Usage

Modify config/sitemap_config.yml to your needs (models has to be an array)

production:
  domain: your-site.com
  models: ['user', 'content']

Include the MixinSitemap module in every model that should update the sitemap after a change:

include MixinSitemap

Add a method self.find_for_sitemap to your models to restrict what will be added to the sitemap. Default is find(:all)

def self.find_for_sitemap
  find(:all, :conditions => ["status = 1"], :order => "id")
end

Development

This project can be found on github at the following URL.

github.com/fsmanuel/xml_sitemap_generator

Feel free forking the project.

Credits

Arne Brachhold, who made the fantastic “Google (XML) Sitemaps Generator for WordPress” which gave me the basic idea – http://www.arnebrachhold.de
Harry Love, who wrote “Google Sitemaps with Ruby on Rails, Capistrano, and Cron” on his Blog: http://harrylove.org