Skip to content

Instantly share code, notes, and snippets.

@juanjoseijas
Created April 3, 2013 13:21
Show Gist options
  • Save juanjoseijas/5301147 to your computer and use it in GitHub Desktop.
Save juanjoseijas/5301147 to your computer and use it in GitHub Desktop.
Sitemap for Middleman
url: http://www.example.com
<% 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><%= data.site.url %>/<%= p.destination_path.gsub('index.html','') %></loc>
<lastmod><%= File.new(p.source_file).mtime.to_date %></lastmod>
<% if priority = p.metadata[:page]['priority'] %>
<priority><%= priority %> </priority>
<% end %>
</url>
<% end %>
</urlset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment