def xml_sitemap
require 'builder'
buffer = ''
xml = Builder::XmlMarkup.new(:target => buffer, :indent => 2)
if @site.config[:base_url].nil?
raise RuntimeError.new("The Nanoc3::Helpers::XMLSitemap helper requires the site configuration to specify the base URL for the site.")
end
xml.instruct!
xml.urlset(:xmlns => 'http://www.google.com/schemas/sitemap/0.84') do
@items.reject { |i| i[:is_hidden] }.each do |item|
item.reps.reject { |r| r.raw_path.nil? }.each do |rep|
xml.url do
xml.loc @site.config[:base_url] + rep.path
xml.lastmod item.mtime.to_iso8601_date unless item.mtime.nil?
xml.changefreq item[:changefreq] unless item[:changefreq].nil?
xml.priority item[:priority] unless item[:priority].nil?
end
end
end
end
buffer
end