Skip to content

Commit

Permalink
fix(flaws): stop reporting absolute MDN blog links as broken
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Jul 4, 2023
1 parent 2564465 commit 9f2b823
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build/flaws/broken-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ export function getBrokenLinksFlaws(
// Note! If it's not known that the URL's domain can be turned into https://
// we do nothing here. No flaw. It's unfortunate that we still have http://
// links in our content but that's a reality of MDN being 15+ years old.
} else if (
href.startsWith("https://developer.mozilla.org/") &&
!href.startsWith("https://developer.mozilla.org/en-US/blog/")
) {
// It might be a working 200 OK link but the link just shouldn't
// have the full absolute URL part in it.
const absoluteURL = new URL(href);
addBrokenLink(
a,
checked.get(href),
href,
absoluteURL.pathname + absoluteURL.search + absoluteURL.hash
);
} else if (isHomepageURL(hrefNormalized)) {
// But did you spell it perfectly?
const homepageLocale = hrefNormalized.split("/")[1];
Expand Down

0 comments on commit 9f2b823

Please sign in to comment.