Skip to main content


Showing posts from September, 2009

Ruby script for generating Google sitemaps

I just wrote a small Ruby script to generate a Google sitemap out of file directory. I thought that it might come handy as a quick start for someone, so here is the code (requires the builder gem)

require 'builder'
htmlfiles = Dir.glob("*.html")
x = => $stdout, :indent => 1)
x.urlset( "xmlns" => "" ) {
for file in htmlfiles do
x.url{x.loc "{file}"; x.lastmod "2009-09-17"; x.changefreq "monthly"; x.priority "0.8"}