Skip to content

Add a link checker in CI to avoid broken links #254

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

Open
rgommers opened this issue May 20, 2020 · 1 comment
Open

Add a link checker in CI to avoid broken links #254

rgommers opened this issue May 20, 2020 · 1 comment
Labels
deployment sprintable Issue fits the time frame and setting of a sprint

Comments

@rgommers
Copy link
Member

This is a follow-up to gh-232. Getting a link checker to work with Hugo isn't completely trivial, but should be doable in CI. See https://discourse.gohugo.io/t/link-checker-for-go-hugo/2202/18

@rgommers
Copy link
Member Author

rgommers commented May 8, 2021

I gave this a quick try, this is doable without too much effort. And there are a lot of things to fix. Steps:

  • Install htmltest locally, see https://github.com/wjdp/htmltest
  • Add a .htmltest.yml in the root of the repo
  • Run ./bin/htmltest and see what it says. Either add config options to silence false positives, or fix things up.
  • Once it's passing, add it in CI.

.htmltest.yml should be something like:

DirectoryPath: "public"
EnforceHTTPS: true
IgnoreURLs:
- "example.com"
CacheExpires: "6h"
IgnoreDirectoryMissingTrailingSlash: true

This gives:

$ ./bin/htmltest htmltest started at 03:46:33 on public
========================================================================
contribute/index.html
  alt text empty --- contribute/index.html --> /images/logos/numpy.svg
  is not an HTTPS target --- contribute/index.html --> http://github.com/numpy/numpy
  empty hash --- contribute/index.html --> #
learn/index.html
  alt text empty --- learn/index.html --> /images/logos/numpy.svg
....

(many more issues)

Missing alt text is an accessiblity issue, and we should prioritize fixing that. Broken links too of course. The rest I haven't looked at in detail.

@rgommers rgommers added the sprintable Issue fits the time frame and setting of a sprint label May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment sprintable Issue fits the time frame and setting of a sprint
Projects
None yet
Development

No branches or pull requests

1 participant