Skip to content

Commit

Permalink
fix: add missing broken link reports
Browse files Browse the repository at this point in the history
  • Loading branch information
yin1999 committed Aug 4, 2023
1 parent 20a154c commit 0a8b5a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build/flaws/broken-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ export function getBrokenLinksFlaws(
`/${DEFAULT_LOCALE}/`
);
const enUSFound = Document.findByURL(enUSHrefNormalized);
// Note, we still recommend that contributors use localized links,
// even if the target document is still not localized.
if (enUSFound) {
// Only the en-US document exists
// We found the en-US version of the document. Just link to that.
mutateLink(a, null, enUSFound.url);
} else {
const enUSResolved = Redirect.resolve(enUSHrefNormalized);
Expand All @@ -338,6 +340,9 @@ export function getBrokenLinksFlaws(
enUSFallbackURL
);
}
} else {
// The link is broken and we don't have a suggestion.
addBrokenLink(a, checked.get(href), href);
}
}
}
Expand Down

0 comments on commit 0a8b5a3

Please sign in to comment.