Link checking

How the site’s links are checked, locally and in CI.

The site is link-checked with two tools:

  • htmltest — the original checker and current default, run by check:links. It is installed automatically on first run, if necessary, so no setup is needed. It also backs the scripts and workflows related to the refcache.
  • Lychee — a faster alternative that contributors can test drive.

To check links locally (using htmltest), run:

npm run check:links

Or to try Lychee run the following after installing it:

npm run _lychee -- check:links

Common commands

CommandChecking scopeChecker
check:linksWhole siteLINK_CHECKER (default htmltest)
check:links:htmltestWhole sitehtmltest
check:links:lycheeWhole siteLychee
check:links:diffChanged files onlyLychee

The check:links and check:links:* scripts run over a build of BUILD_KIND. For details, see Build kinds: full and lean

Refcache

The site has an external-link cache (refcache) under version control. It is created and updated by htmltest. Lychee is not currently setup to refresh the refcache. To refresh the refcache, run either fix:refcache or check links with htmltest.

Refcache refresh and housekeeping workflows

The following workflows are scheduled daily and run a link checking command:

WorkflowCheckerBuild
Refcache refresh (fix:refcache)htmltestfull
Housekeeping (fix-and-test:all)htmltestfull

Refcache refresh prunes the refcache and runs check:links:htmltest, which refreshes the refcache for the pruned entries, if they are still used in the docs.

The housekeeping workflow runs fix-and-test:all, which calls fix:refcache and deliberately skips check:links so links are checked exactly once (via htmltest, refreshing the refcache).

In CI

The check-links.yml workflow builds the site once (lean) and shares that artifact across the htmltest shards and the Lychee check, so local runs and CI check the same build.