Skip to content

Instantly share code, notes, and snippets.

@jnbt
jnbt / sitemap.xml.erb
Created October 22, 2012 14:03 — forked from ls-lukebowerman/sitemap.xml.erb
Sitemap (sitemaps.org) generator for Middleman
<% base_url = "http://youdomain.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><%= base_url + p.destination_path.gsub('index.html','') %></loc>
<% if priority = p.metadata[:page]['priority'] %>
<priority><%= priority %> </priority>
<% end %>