Repository navigation
Description
Part of #103 (V-06).
packages/rules/src/links/anchor-text.ts iterates doc.querySelectorAll("a[href]") and pushes one
finding per link. The standard card pattern — an image link, a headline link and a Read more link,
all pointing at the same target — therefore produces two findings: empty-anchor for the image
wrapper and generic-anchor for Read more, while the headline link in the same card names the
target perfectly.
Nothing is wrong with that markup. It is the recommended pattern: the image and the Read more
affordance are redundant links to a target the card already labels.
Measured: an internal audit pass making exactly this mistake reported 163 findings on a 163-page
site. Recounting per (source page, target) pair took it to 0 real. A rule that fires on every blog
index and every service grid trains users to ignore the whole links category.
The fix is the counting unit, not the detection: group a page's outgoing links by resolved target,
and evaluate the group. A group passes if any member carries usable text (text content, image
alt, aria-label, aria-labelledby, title, or an accessible SVG name — all already handled per
link).
Note this is narrower than it sounds: genuinely empty single links, and cards where every link is
empty or generic, must still be reported. The accessibility concern about an empty link in the tab
order is real, but it belongs to the a11y category, which has its own rules for it —
links/anchor-text is an SEO rule about whether the destination is described.
Acceptance Criteria
-
links/anchor-textgroups a page's outgoing links by resolved target URL before evaluating - A target group is reported as
empty-anchoronly when NO link in the group carries any accessible name (text, image alt, aria-label, aria-labelledby, title, or SVG accessible name) - A target group is reported as
generic-anchoronly when EVERY link in the group has generic text - Findings are deduplicated per target: one card produces at most one item
- Fixture: card with
<a><img alt=""></a>,<a>Commercial freezer repairs</a>and<a>Read more</a>all pointing at the same URL — no findings - Fixture: single
<a><img alt=""></a>with no sibling link to the same target — still reported asempty-anchor - Fixture: card where all three links are empty or generic — reported once, not three times
- Existing tests updated, and a regression test asserts the multi-link card yields zero findings
- Docs rule page for
links/anchor-textupdated indocs/to describe per-target evaluation
Activity
nc9 commentedon Aug 19, 2026
🐹 hamsterwheel claimed this issue.
loop-mszv1wzc-104loop/104-links-anchor-text-counts-per-link-not-penc9 commentedon Aug 19, 2026
🐹 PR opened: #111
--pr-only: stopping here for human review — merge gate and auto-merge skipped.fix(rules): links/anchor-text evaluates links per target, not per link (