1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-10-17 17:01:01 +00:00
holgerjust.de/source/sitemap.xml.builder
Holger Just 97ea6575af middleman init holgerjust.de --template=casper
We use the casper theme from
https://github.com/danielbayerlein/middleman-casper in version
34ec5aa9e2a7f179146a5e21d31b4ba61e2bd926
2015-08-26 18:43:13 +02:00

18 lines
586 B
Ruby

xml.instruct!
xml.urlset 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9" do
sitemap.resources.select { |page| page.destination_path =~ /\.html/ && page.data.noindex != true }.each do |page|
xml.url do
xml.loc URI.join(settings.casper[:blog][:url], page.destination_path)
last_mod = if page.path.start_with?('articles/')
File.mtime(page.source_file).to_time
else
Time.now
end
xml.lastmod last_mod.iso8601
xml.changefreq page.data.changefreq || "monthly"
xml.priority page.data.priority || "0.5"
end
end
end