Replies: 4 comments 2 replies
-
I ran the script over the entire corpus and found 2664 broken anchors (with duplicates) and 116 broken links. Good luck! |
Beta Was this translation helpful? Give feedback.
-
const referencedPath = path.join(
"build",
url.pathname.toLowerCase().replace(":", "_colon_"),
"index.html"
); the rule of |
Beta Was this translation helpful? Give feedback.
-
This is great, and we should totally fix all broken anchors. To maintain quality, I wonder if we should morph this into a CI test for each PR, checking the anchors on the pages touched by the PR: |
Beta Was this translation helpful? Give feedback.
-
This is incredibly useful @Josh-Cena - thank you! |
Beta Was this translation helpful? Give feedback.
-
I sent mdn/content#22140 to fix a lot of anchor links. Here's the script I used:
You can build a mostly self-contained part of the site, like:
and then run this script:
(It's ESM, so use
.mjs
extension)analyze.log
would look like this:And now is time to fix all the errors!
A caveat: it doesn't follow redirects. It's a feature, not a bug: we should update the redirected links to the new location anyway. Redirect links are also reported as a flaw by Yari.
Beta Was this translation helpful? Give feedback.
All reactions