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

Ignore Jekyll redirect_from template from favicon check #448

Merged
merged 2 commits into from
Aug 28, 2017
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
4 changes: 4 additions & 0 deletions lib/html-proofer/check/favicon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def run

return if found

# specific match for Jekyll's redirect_from template:
# https://git.io/v5stq
return if @html.xpath('//title').text == 'Redirecting…'

add_issue('no favicon specified')
end
end
6 changes: 6 additions & 0 deletions spec/html-proofer/favicon_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@
proofer = run_proofer(broken_but_ignored, :file, check_favicon: true)
expect(proofer.failed_tests.first).to match(/no favicon specified/)
end

it 'specifically ignores jekyll redirect_from template' do
broken_but_ignored = "#{FIXTURES_DIR}/favicon/jekyll_redirect_from.html"
proofer = run_proofer(broken_but_ignored, :file, check_favicon: true)
expect(proofer.failed_tests).to eq []
end
end
9 changes: 9 additions & 0 deletions spec/html-proofer/fixtures/favicon/jekyll_redirect_from.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en-US">
<meta charset="utf-8">
<title>Redirecting&hellip;</title>
<meta http-equiv="refresh" content="0; url={{ page.redirect.to }}">
<meta name="robots" content="noindex">
<h1>Redirecting&hellip;</h1>
<script>location="{{ page.redirect.to }}"</script>
</html>