Link checking

Speed up external link checking with lean-render builds for checkers

A link checker that crawls your built site re-checks the repeated, auto-generated chrome — the navbar, footer, and left-nav — on every page, even though those links are often identical site-wide. On a large site that’s the bulk of the work, and it inflates checker output.

Lean render is a build mode that omits the repeated chrome from the output, so a checker reaches each link once instead of once per page. It works with any external link checker, needs no extra post-build pass, and keeps just enough instances of each region to keep its repeated links reachable:

  • Navbar and footer: kept on each locale’s home page. Their links are config-defined and the same across the locale, except for the navbar’s language selector (and an optional version menu) — see the caution.
  • Left-nav (computed per page): kept on each locale’s docs landing page, which carries the full docs tree. On a doc-rooted site, that landing page is the home page.

The navbar’s language selector points to each page’s own translation rather than a fixed target, but those translations are docs pages that the destination locale’s left-nav already covers, so the single kept navbar loses no reachable link.

Dropping the repeated chrome also makes a lean build a much less noisy basis for diffing generated output: changes to a shared region show up once, instead of on every page, so a diff surfaces the content that actually changed.

Enabling lean render

Set the td.lean_render parameter to remove:

[params.td]
lean_render = "remove"
params:
  td:
    lean_render: remove

For a link-checking CI job, it’s usually cleaner to set it through the environment instead, leaving your committed config untouched:

HUGOxPARAMSxTDxLEAN_RENDER=remove hugo

Use a non-underscore delimiter (x above), not HUGO_PARAMS_TD_LEAN_RENDER: Hugo treats every _ after the HUGO prefix as a key separator, which would split the lean_render key. See Hugo’s configuration with environment variables.

The value names the mode. Only remove is implemented; any other or empty value leaves the chrome in place.