Skip to content

Instantly share code, notes, and snippets.

@SteveBenner
Forked from ls-lukebowerman/sitemap.xml.erb
Last active April 24, 2016 12:01
Show Gist options
  • Save SteveBenner/8897566 to your computer and use it in GitHub Desktop.
Save SteveBenner/8897566 to your computer and use it in GitHub Desktop.
Slim template - generates a sitemap for Middleman
- pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) }
doctype xml
urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
- pages.each do |p|
url
loc "http://www.YOUR_WEBSITE_URL/#{p.destination_path.gsub('/index.html','')}"
lastmod = Date.today.to_time.iso8601
changefreq = p.data.changefreq || 'weekly'
priority = p.data.priority || '0.5'
@SteveBenner
Copy link
Author

Thanks to Lukebowerman for the original gist - he da man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment