Skip to content

Instantly share code, notes, and snippets.

@dahal
Forked from ls-lukebowerman/sitemap.xml.erb
Last active August 29, 2015 14:27
Show Gist options
  • Save dahal/f069071632f18c8ed36f to your computer and use it in GitHub Desktop.
Save dahal/f069071632f18c8ed36f to your computer and use it in GitHub Desktop.
Sitemap (sitemaps.org) generator for Middleman
<% pages = sitemap.resources.find_all{|p| p.source_file.match(/\.html/) } %>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<% pages.each do |p| %>
<url>
<loc>http://youdomain.com/<%=p.destination_path.gsub('/index.html','')%></loc>
<priority>0.7</priority>
</url>
<% end %>
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment