Wednesday, September 9, 2009

How do i generate SEO sitemap in rails ?

by Sandip Ransing 6 comments
Tags

What is sitemap ?

Sitemap is nothing but a .xml file containing urls available on your site

It contains URL, last modified date, frequency of content change and priority ( between 0..1 )

Why we need sitemap ?

We can submit sitemap file to search engine. It will help them in analysing what urls on your site are available for crawling.

What is xml pattern ?

   <?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
...
...
</urlset>

What will be the path for sitemap ?

"www.example.com/sitemap.xml"

Are we going to generate sitemap manually ?

No... there is mephisto sitemap plugin.We can use it.

script/plugin install http://svn.appelsiini.net/svn/rails/plugins/mephisto_sitemap/

Am i needed to generate to sitemap for each request ?

No ...........we can generate it in background task daily basis.

How it will be accessed for request to sitemap ?

we can define path to local file in routes.

map.connect "sitemap.xml", :controller => :sitemap

Class SitemapController

def index

render "some local file path"

end

....

Here are the reference links

http://www.fortytwo.gr/blog/19/Generating-Sitemaps-With-Rails

http://www.bestechvideos.com/2008/07/04/ruby-plus-71-how-to-create-a-seo-sitemap-for-rails-apps

blog comments powered by Disqus

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter