Help us shape the future of Go! Take the 2026 Go Developer Survey

sitelinks

command
v0.68.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Command sitelinks says whether every local link of a BUILT static site leads to a file of that build:

sitelinks [--base /docs/development/] PUBLIC_DIR

It reads every .html under PUBLIC_DIR, takes the href, src, poster and srcset attributes, resolves each local one against the page's own URL under --base, and checks that the target exists in the build (a directory counts when it holds an index.html). External links are not fetched.

⛔ It parses HTML, it does not grep it. The first version was a regular expression over the page and reported two "broken" links on every page of a Hugo site: `e.docsRoot+t.version+` and a minified line of a version-selector script, both read as an href= inside an inline <script>. Attributes come from golang.org/x/net/html's tokenizer here, so text inside <script> is never an attribute.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL