Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect_to Pages should not have a layout. #115

Merged
merged 2 commits into from
Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jekyll-redirect-from/redirect_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions lib/jekyll-redirect-from/redirector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ 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
end
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))

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
Expand Down