-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: link tests #645
docs: link tests #645
Conversation
/cc @emplums on broken-link-checker, which might be useful for primer/components ✨ |
197cd06
to
4cdb2f3
Compare
Okay @jonrohan, this is ready for review! ✌️ |
FYI, this is what the output looks like in Travis logs (without color):
I made an asciinema recording to show what it looks like locally with: # cd docs
script/check-links http://localhost:3000/css -v ProTip: The |
This runs a link checker (broken-link-checker) against all of our pages and lists all of the broken links. It can do images and metadata in addition to
<a>
tags, and you can exclude external URLs. The tool requires a running web server, so we run it on the public deployed URL, which is actually way faster than running it against the site in dev mode (locally or on Travis).I've written a custom "reporter" for the link checker that (IMO) is much easier to read and scan than the
blc
CLI's. 🤓Most (all?) of the links marked as broken as of 45cd0ac are to private repos such as
github/github
(source for unpublished components) andgithub/design-systems
(feedback issues, etc.). I think it's safe to exclude them with--exclude 'https://github.com/github/*'
, but there's also some value to seeing those links listed out and knowing that there are links listed that will 404 for non-Hubbers.A nice follow-up to this would be to help PR authors trace the source of the broken links, since most of the files in
pages/css
are generated by our sync script. Thescript/check-relative-links
script has most of what we'd need to do that: namely, use remark to parse the Markdown andselectAll('link[href="..."]')
to find its position in the document. For now, that script exists to identify potential sources of broken links from relative links (../utilities
vs./css/utilities
).This basically ticks off a box in #628 ("All documentation links such as status, npm packages, and view source should work").