Path: blob/main/_plugins_dev/sitemap-fake.rb
1677 views
module Jekyll1module Generators2# Fake sitemap generator.3class SitemapGenerator2 < Generator4safe true56def generate(site)7result = '<?xml version="1.0" encoding="UTF-8"?>'8result += '<!-- This sitemap has FAKE modification dates intentionally, that step is slow. -->'9result += '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' \10'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ' \11'http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" ' \12'xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'131415subset_pages = site.pages16.reject { |t| t.path =~ /ipynb$/ || t.path =~ /api\/ga4gh\/trs\/v2/}17.reject { |t| t.data.fetch('layout', 'page') =~ /external/}18.reject { |t| t.data.fetch('hands_on', '') == 'external'}1920subset_pages.each do |t|21result += "<url><loc>#{site.config['url'] + site.config['baseurl'] + t.url}</loc>" \22'<lastmod>2016-06-30T18:00:00-07:00</lastmod></url>'23end24result += '</urlset>'2526page2 = PageWithoutAFile.new(site, '', '.', 'sitemap.xml')27page2.content = result28site.pages << page229end30end31end32end333435