Skip to content

Query-string variants of a page are counted as separate affected pages #858

Closed

Description

@nc9

Problem

A page and its query-string variant are audited as two pages and counted twice in the same finding. Example from a stored audit: /contact and /contact?subject=Billing both appear under schema/expected-type as separate affected pages, though the second is the same template with a prefilled form field.

Findings on a page like this overstate the number of affected pages and inflate page counts in the report.

Expected

Query-string variants that render the same page (same canonical, same content) are not each counted as an affected page. Either the crawler collapses them, or the report groups them under the canonical page, so one issue on one template reads as one page.

Open question for triage: collapse by rel=canonical, by a parameter allow/deny list, or by content hash. Changing what the crawler fetches is a larger decision than changing how the report counts.

Acceptance Criteria

  • A page and a query-string variant that declares the first as its canonical are reported as one affected page, not two
  • Variants whose content genuinely differs (search, pagination, filters with distinct canonicals) are still audited and listed separately
  • The affected-pages count, the page total in the report header and the per-section page counts agree after the change
  • No change to health score on audits with no query-string variants (golden baseline unchanged)
  • The decision (crawler skip vs report grouping) is written in the issue before implementation starts

Activity

  1. added
    enhancement
    size: M
    rules
    on Oct 16, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Decision proposal (needs a maintainer yes before implementation, per the last acceptance criterion).

    Recommendation: group in the report by declared canonical; do not change what the crawler fetches.

    • Why not the crawler: the canonical is only known after the variant is fetched, so skipping variants at the frontier needs a parameter allow/deny list, which is a per-site guess (?page=2, ?sort=, ?subject= all differ in meaning) and silently drops pages from the audit. Content-hash collapsing needs both pages fetched too, and two real pages with the same shell would merge.
    • Rule: a crawled page whose rel=canonical resolves (after the usual URL normalisation) to a different crawled page of the same site, with the same path, is a variant of that page. Pages with no canonical, a self canonical, or a canonical on another path or host are not variants, so search, pagination and filter pages with their own canonical stay separate and are listed separately.
    • Counting: for the affected-pages list and count of a finding, a variant is counted under its canonical page (one page if both fail). The rows still show the variant URL beside the canonical ("/contact (and 1 query-string variant)") so nothing is hidden. The header total, meta.totalPages and the per-section counts use the same canonical-group count and the report says how many variants were folded ("53 pages, 4 query-string variants counted with their canonical"), so the three agree.
    • Scores: unchanged. Each variant still gets its own checks, so tallies and the health score do not move; only the page counts in the report text change. An audit with no query-string variants is byte-identical (golden baseline unchanged).
    • Where: one canonical-group map built once from the stored page_features.canonical (already stored) and applied where the report builds affectedPages; the header and section counts read the same map.

    Open question for the maintainer: should the header total show canonical groups (53) with the variant note, or the raw crawled count (57) with the note? I recommend groups, since that is what "pages" means to a reader.

    nik

  4. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Decision (maintainer, 2026-10-30): group in the report by declared canonical. The crawler is unchanged and no score changes.

    • A crawled page whose rel=canonical resolves to a different crawled page of the same site on the same path is a variant of it. Pages with no canonical, a self canonical or a canonical elsewhere are separate pages, so search, pagination and filter pages with their own canonical are still listed separately.
    • A finding counts a variant under its canonical page (one page when both fail). The variant URLs are not repeated beside each affected page (that would change the list code of every output format and bloat the lists): they are listed once, with the page each is counted with, in meta.canonicalVariantPages (JSON, first 100) and counted on the scan line. Amended after review: this keeps every variant URL in the report without per-row annotations.
    • The header total and the per-section counts are canonical groups, with a note: "N query-string variants counted with their canonical". An audit with no variants is byte-identical.

    Implementing in a PR that references this issue.

    nik

  5. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Checked against main (23a34c1, v0.0.144). Ticked what holds. Open: the criterion that the affected-pages count, the header total and the per-section page counts agree is asserted for the first two and the scan line in the e2e test, but per-section page counts are not asserted anywhere.

    nik

  6. nc9 commented on Nov 2, 2026

    @nc9
    ContributorAuthor

    Verified on main (e86767ff). Run locally: canonical-groups-858.test.ts (10 pass) and canonical-variants-report-1350.test.ts (6 pass). The commits are 5aefb9c9 (report and CLI count a variant with its canonical), 32bc3315 and a12bb84b (dedupe of folded items), plus 9465a86a (#1350, shared report builder and entity map).

    The last box, ticked on this evidence: the report builder test shows totalPages dropping by one with the fold on, the variant gone from pages and from every rule result, and the score and tallies unchanged; the entity map test shows pagesTotal agreeing with the folded page list; and foldChecksToCanonical rewrites a check's details.count and occurrences to follow the deduplicated item list (3 becomes 2). Per-section counts are therefore derived from the folded lists, not asserted as a separate rendered number, which is the one place I read the criterion as met by construction. All boxes ticked, closing.

    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

    enhancementrulessize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions