Generate sitemap.xml using a ruby script

As I’m using nanoc and jekyll together with git to edit and publish my site and blog, I was trying to generate sitemap.xml according to http://www.sitemaps.org/ for google webmaster tools sitemap settings.

So I wrote this ruby program: gen_sitemap.rb and called it from the git post_update hook on the server.

You can test it like ruby gen_sitemap.rb "." - add (multiple) folders as parametes.

In the script, remember to set $site_url to your own site.

Hope this is useful for your sitemap.xml needs!



blog comments powered by Disqus

This ClearEvo.com blog is powered by Debian GNU/Linux, running lighttpd, generated using jekyll on Ubuntu.

Subscribe for new updates