Skip to content

Commit

Permalink
Check if any of the known page ids include the hash being checked for
Browse files Browse the repository at this point in the history
  • Loading branch information
howard-e committed Sep 25, 2023
1 parent 7b0b4d3 commit 8125707
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/link-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ async function checkLinks() {

let matchesHash = true;
if (hash) {
matchesHash = !!matchingPage?.ids.includes(hash);
matchesHash = !!matchingPage?.ids.some((id) => id.includes(hash));
}

const isLinkBroken = !(
Expand Down Expand Up @@ -274,7 +274,11 @@ async function checkLinks() {
hrefOrSrc.match(pattern)
);

if (!isHashCheckingDisabled && hash && !pageData.ids.includes(hash)) {
if (
!isHashCheckingDisabled &&
hash &&
!pageData.ids.some((id) => id.includes(hash))
) {
consoleError(
`Found broken external link on ${htmlPath}:${lineNumber}:${columnNumber}, ` +
'hash not found on page'
Expand Down

0 comments on commit 8125707

Please sign in to comment.