Open source · Content & Publishing

Anchor Text Balance Auditor

Review internal anchor text distribution for clarity and natural coverage.

v0.1.0 · Node.js 22+ · MIT

Browse the public repository · View releases

Audit an export of internal anchors: compute each anchor's accessible name, group the anchor variants by target, context and locale, and report empty, misleading and over-repeated link text.

This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+; inspect the source before using it on your own files.

Run the checked-in example

node bin/anchor-text-balance-auditor.mjs --export examples/site-clean.json
node bin/anchor-text-balance-auditor.mjs --export examples/site-broken.json --json

Read the result

anchor-text-balance-auditor: status pass 21 anchor(s) from 2 export document(s); 21 named, 0 unnamed, 0 unresolved, 5 image-only but named. 7 editorial and 14 navigation anchor(s) over 3 declared context(s); 0 not scored. 11 anchor variant(s) in 9 target/context/locale group(s): 0 over-repeated, 2 expected navigation repeat(s), 0 ambiguous, 0 misleading. 0 error, 0 warning, 2 info. INFO site-clean.json /anchors/0 navigation-repetition-expected Navigation anchor text "example handbook home" points at "/" 5 time(s) in locale "en"; repetition in a navigation context is expected and was not counted against the editorial budget. INFO site-clean.json /anchors/5 navigation-repetition-expected Navigation anchor text "docs" points at "/docs/" 5 time(s) in locale "en"; repetition in a navigation context is expected and was not counted against the editorial budget.

Where this check stops

Unknown evidence is never a pass. Four things make a run incomplete even though nothing failed: an anchor named through aria-labelledby (an export cannot resolve it), an anchor in an undeclared context (its kind is unknown, so repetition cannot be scored), an anchor with no locale and no defaultLocale, and an anchor pointing at an undeclared target. Each is reported as a warning, and the report is still not a pass.

Before adapting the command to your own workflow, review the accepted inputs, exit codes and safety boundaries in the README.

Compiled with AI assistance from checked-in public documentation and example scripts. Run the example and review the repository's current documentation before relying on its result.