Skip to content

Commit

Permalink
Print orphaned pages as part of 'make htmlproofer', ref #117
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Mar 7, 2018
1 parent cc58f1d commit 93c8dfa
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions themes/cucumber-hugo/tools/htmlproofer/htmlproofer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ def run
end
end

$pages = []
$linked_pages = []

at_exit do
orphans = $pages - $linked_pages
puts "=== Orphaned pages ==="
puts orphans
end

class OrphanCheck < HTMLProofer::Check
def run
if @path === 'public/documentation/index.html'
$linked_pages = @html.css('a').map do |node|
create_element(node).file_path
end
else
$pages << @path
end
end
end

# To speed up local development, external links are only checked in CI:
# https://app.netlify.com/sites/cucumber/settings/deploys
external_link_check = ENV['EXTERNAL_LINK_CHECK'] == 'true'
Expand Down

0 comments on commit 93c8dfa

Please sign in to comment.