Skip to content

Broken links report: say which pages carry the link and where, no duplicate sources #837

Closed

Description

@nc9

The broken links finding does not say clearly which pages carry the broken link or where on the page it sits.

Example (anonymised): one broken internal link found on three pages renders as:

  • 1 broken internal link(s) (4xx/5xx) (3 pages)
  • 3 pages affected, then the three page paths
  • 1 item: the target and its status, then from: lines that list one of the pages twice (it links to the target twice), then +1 more (see full list above)

Problems:

  1. Duplicate source rows. sourcePages is built per link, not per page (packages/rules/src/links/broken-links.ts, sources.push(page.url) per link), so a page that links twice appears twice, and meta.linkedFrom counts links while the heading counts pages.
  2. No per-page section. The item label carries one aggregate phrase for all sources ("linked in the page content", from meta.sections). The reader cannot tell that one page links from the footer and another from the body.
  3. Dead pointer. +N more (see full list above) (packages/report/src/output/html.tsx near the item from: list, markdown.ts near REPORT_SOURCE_PAGES_PREVIEW) points at the "pages affected" list, which holds page URLs only and does not expand per-item sources.
  4. Redundant structure. "3 pages affected" and "1 item" say the same thing twice with different counts.

Related: the section phrases landed on link rules in the section-findings work (#2307).

Acceptance Criteria

  • Each source page appears once per broken link; repeat links from the same page show as a count (for example "2 links"), not a second row
  • Each source line says where on that page the link sits (header, footer, navigation, sidebar, page content) when the section is known, and says nothing when it is not
  • The summary line separates links from pages (for example "1 broken link, found on 3 pages")
  • No "see full list above" text remains; anything truncated has its full list reachable in the same block (expand or copy)
  • The same structure holds in html, markdown, text, llm and console; json and xml carry per-source sections as data
  • links/broken-external-links and the other link rules that list source pages use the same layout, or a follow-up issue is filed for each that does not
  • Renderer tests cover a target linked twice from one page and a target linked from two different sections

Activity

  1. added
    bug
    size: M
    on Oct 15, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Checked against current main. Criteria 1 to 3 and 5 to 7 already hold (each source page once with its link count and section, a "found on 3 pages" summary, the per-source sections as data in json and xml, tests per renderer in item-sources-837.test.ts). Criterion 4 had one gap: a list over three sources said "+N more pages" in markdown with no full list. The draft PR lists every source in markdown, and the text, console and llm reports keep the three-page preview with the count.

    nik

  4. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Clarifying criterion 4 for the PR: text, console and llm keep the three-page preview with the count of the rest, while markdown and html show the full list (html expands in place).

    nik

  5. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.144 (commits d3b89d1, 77593cf). Checked every acceptance criterion against current main: every source page once with its link count and section, the summary separates links from pages, no dead pointer, per-source sections in json and xml, tests per renderer; markdown lists all sources and the other renderers keep the three-page preview with the count (the maintainer's clarification of criterion 4).

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsize: M

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions