Google sitemap files for Rails projects
Add this route towards the bottom of your config/routes.rb file (more specific routes should be listed above it): map.sitemap ‘/sitemap.xml’, :controller => ‘sitemap’ Create the SitemapController (app/controllers/sitemap_controller): class SitemapController < ApplicationController layout nil def index headers[‘Content-Type’] = ‘application/xml’ last_post = Post.last if stale?(:etag => last_post, :last_modified => last_post.updated_at.utc) respond_to do |format| format.xml { @posts = … Read more