From 3b78da673a79777659f44b33cf19322537d72a12 Mon Sep 17 00:00:00 2001 From: Pat Hawks Date: Mon, 11 Jul 2016 17:45:01 -0500 Subject: [PATCH 1/2] Centralize sitemap exclusion --- lib/jekyll-redirect-from/redirect_page.rb | 2 +- lib/jekyll-redirect-from/redirector.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/jekyll-redirect-from/redirect_page.rb b/lib/jekyll-redirect-from/redirect_page.rb index a24c20a..efbe19c 100644 --- a/lib/jekyll-redirect-from/redirect_page.rb +++ b/lib/jekyll-redirect-from/redirect_page.rb @@ -15,7 +15,7 @@ def initialize(site, base, dir, name) @name = name self.process(name) - self.data = { "layout" => nil } + self.data = { "layout" => nil, "sitemap" => false } data.default_proc = proc do |_, key| site.frontmatter_defaults.find(File.join(dir, name), type, key) diff --git a/lib/jekyll-redirect-from/redirector.rb b/lib/jekyll-redirect-from/redirector.rb index c2813e8..222e9a0 100644 --- a/lib/jekyll-redirect-from/redirector.rb +++ b/lib/jekyll-redirect-from/redirector.rb @@ -15,7 +15,6 @@ def generate_alt_urls(site, list) alt_urls(item).each do |alt_url| redirect_page = RedirectPage.new(site, site.source, "", "redirect.html") redirect_page.data['permalink'] = alt_url - redirect_page.data['sitemap'] = false redirect_page.generate_redirect_content(redirect_url(site, item)) site.pages << redirect_page end @@ -28,7 +27,6 @@ def generate_alt_urls(site, list) redirect_page = RedirectPage.new(site, site.source, File.dirname(item.url), File.basename(item.url)) redirect_page.data['permalink'] = item.url - redirect_page.data['sitemap'] = false redirect_page.generate_redirect_content(alt_url) if item.is_a?(Jekyll::Document) item.content = item.output = redirect_page.content From fc60d674c682ccbfa70651065fc3200168dd9c2a Mon Sep 17 00:00:00 2001 From: Pat Hawks Date: Mon, 11 Jul 2016 18:45:55 -0500 Subject: [PATCH 2/2] redirect_to Pages should not have a layout --- lib/jekyll-redirect-from/redirector.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jekyll-redirect-from/redirector.rb b/lib/jekyll-redirect-from/redirector.rb index 222e9a0..311b4b0 100644 --- a/lib/jekyll-redirect-from/redirector.rb +++ b/lib/jekyll-redirect-from/redirector.rb @@ -22,6 +22,7 @@ def generate_alt_urls(site, list) if has_redirect_to_url?(item) redirect_to_url(item).flatten.each do |alt_url| item.data['sitemap'] = false + item.data['layout'] = nil item.url << "index.html" if item.url.end_with?("/") redirect_page = RedirectPage.new(site, site.source, File.dirname(item.url), File.basename(item.url))