Adding a sitemap.xml file to Mephisto

Should be an easy task, right? We’ll it wasn’t bad, but it could be easier. After a bunch of googling and failed attempts I settled on this mephisto sitemap plugin. According to the blog it should be easy, just script/plugin install and away you go…

Unfortunately, this doesn’t work out of the box, a few very minor changes are required. I found both of these in the comments on the blog release, but thought it might be helpful for someone else to have a concise walk through here.

Before beginning though, you might want to check out piston if you’re a subversion user.

The first step is to add the follow line to lib/mephisto/routing.rb

      map.connect '/sitemap.xml', :controller => 'sitemap', :action => 'index'

For some unexplained reason the add_route call in vendor/plugins/mephisto_sitemap/lib/sitemap.rb doesn’t seem to be executing properly. If you’re worried you can comment it out, but it doesn’t seem to be causing an issue.

Next, you need to make a change to the second line in vendor/plugins/mephisto_sitemap/lib/sitemap_controller.rb

  self.view_paths = File.join(File.dirname(__FILE__),'../', 'views')

This is required due to a change in edge rails where template_root has been switched to views_path.

Now you should be ready to go. Restart your server and hit up **/sitemap.xml** to see your new plugin in action. Also, don’t forget to visit Google’s Sitemaps for Webmasters and add your sitemap.

1 comment so far

Well written article.

Lexine
October 29th, 2008 at 12:47 am

Leave a Comment

Name (required)

Mail (will not be published) (required)

Website

Comment

Rambling one post at a time