Supress warning issued for redirect pages (#8347)

Merge pull request 8347
This commit is contained in:
Seeker 2020-08-19 10:16:18 -07:00 committed by GitHub
parent 2afa51b9e1
commit 4f81011442
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -151,3 +151,20 @@ Feature: Fancy permalinks
And the _site directory should exist
And I should see "Conflict: The URL '" in the build output
And I should see "amazing.html' is the destination for the following pages: awesome.md, cool.md" in the build output
Scenario: Redirecting from an existing permalink
Given I have a configuration file with "plugins" set to "[jekyll-redirect-from]"
And I have a "deals.html" file with content:
"""
---
permalink: /deals/
redirect_from:
- /offers/
---
"""
And I have a "offers.html" page with permalink "/offers/" that contains "Hurry! Limited time only!"
When I run jekyll build
Then I should get a zero exit status
And the _site directory should exist
And I should not see "Conflict: The URL '" in the build output
And I should not see "offers/index.html' is the destination for the following pages: offers.html, redirect.html" in the build output

View File

@ -124,6 +124,8 @@ module Jekyll
def collect_urls(urls, things, destination)
things.each do |thing|
next if allow_used_permalink?(thing)
dest = thing.destination(destination)
if urls[dest]
urls[dest] << thing.path
@ -134,6 +136,10 @@ module Jekyll
urls
end
def allow_used_permalink?(item)
defined?(JekyllRedirectFrom) && item.is_a?(JekyllRedirectFrom::RedirectPage)
end
def case_insensitive_urls(things, destination)
things.each_with_object({}) do |thing, memo|
dest = thing.destination(destination)