Skip to content

feat(rules): skip index-presentation rules on noindex pages #457 - #460

Merged
nc9 merged 2 commits into
mainfrom
feat/skip-index-rules-noindex-457
Oct 5, 2026
Merged

nc9 merged 2 commits into
mainfrom
feat/skip-index-rules-noindex-457

Conversation

@nc9

@nc9 nc9 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #457 (the "index rules skip noindex pages" half; the X-Robots-Tag reporting half shipped in v0.0.103 via #459). Rebased onto v0.0.103 (d279852).

This PR changes scores. Noindex pages stop contributing title, description, H1, duplicate-title, duplicate-description and orphan-page findings. The lead is holding it for Nik.

What changes

A page counts as noindex when its <meta name="robots"> tag or its X-Robots-Tag header contains noindex, including a header scoped to one crawler (googlebot: noindex). This is the existing isPageIndexable(parsed, headers) test that page_features.robotsNoindex and crawl/indexability already use, so every reader agrees on which pages are noindex. robots.txt disallow does not count.

Rules that now skip noindex pages, and why

Rule Scope How it skips Why it only matters for indexed pages
core/meta-title page one skipped check the title's job here is the search result headline
core/meta-description page one skipped check the description is only shown as the search snippet
core/h1 page one skipped check graded as an on-page ranking and relevance signal
core/title-unique site page left out of the grouping duplicate titles only compete with each other in search results
content/duplicate-title site page left out of the grouping same as above
content/duplicate-description site page left out of the grouping a duplicate snippet only matters where snippets are shown
links/orphan-pages site page never reported as an orphan the rule exists so search engines can discover the page; its own outgoing links still count toward other pages

The list is pinned by a test: exactly these three page rules declare skipOnNoindex, and no a11y, security, perf or links rule may. Accessibility, security, performance and broken-link rules, core/robots-meta, crawl/indexability and the other crawl/noindex rules all still run on noindex pages.

The skipped check reads Skipped: page is set to noindex via robots meta tag (or via X-Robots-Tag header) with skipReason: "noindex". Skipped checks are already excluded from scoring.

Noindex pages are skipped only on a site known to be indexed

Vercel, Netlify and Cloudflare Pages preview deployments send X-Robots-Tag: noindex on every page, and a staging site usually carries a site-wide noindex. Those are exactly the pre-launch audits where the title, description and H1 checks matter most, so a naive skip would silently empty them. The run therefore skips noindex pages only when it knows the site itself is being indexed, judged from one reference page:

  1. the homepage: a page on the base URL's host (www/apex and scheme folded) at path / with no query string, that answered below 400. A noindex /?s=term search page or another host's root never stands in for it.
  2. when the homepage was not fetched (a deep-seeded or path-scoped audit, or a homepage that answered with an error), the page the audit started from: the crawl's seed or original URL, matched by the page's stored or final URL.
Reference page Result
indexable noindex pages are skipped
noindex (staging, preview deployment) nothing is skipped, today's behavior
neither the homepage nor the entry page was fetched nothing is skipped, today's behavior

crawl/all-noindex-pages is untouched and still lists every noindex page in all three cases (it reports at info status, so like crawl/indexability it is not in the JSON issue list; the visible per-page signal is core/robots-meta, which since #459 warns on every noindex page, header or meta).

The decision is made once per run (isSiteIndexable) into the tri-state SiteData.siteIndexable in both SiteData builders (runRulesOnStorage and the streaming buildStreamingSiteData), so the page pass and the site pass agree. A caller that never sets it skips nothing.

Caches and fan-out

  • Per-page rule-result cache (fix(rules): schema/breadcrumb no longer fails on one model-labelled link (repo#3365) #1990): the gate's page inputs (HTML, headers) are already in the page key. siteIndexable is new run-level input, so it is added to PAGE_RULE_SITE_FIELDS and hashed into the run context (all three states distinct); a homepage or entry page that turns noindex re-runs every page instead of replaying their results. page-rule-site-context.test.ts (the read-set falsifier) passes with the field declared.
  • Template fan-out (feat(rules): add i18n/locale-mixing rule (repo#1359) #1951): the gate is per page, so createTemplateFanout disqualifies skipOnNoindex rules exactly as it does skipOnSoft404, and template-verdict-page-independence.test.ts now also fails any template-scoped rule that declares it. (The three gated rules are verdictScope: "page" today.)
  • Smart-audit merge: a skipped check normally lands in the publish resolution signal's notEvaluated, which makes the server merge carry prior findings forever. A cloud user's existing "No H1" on a page that is now skipped would therefore never resolve. buildResolutionSignal now treats a skipReason: "noindex" skip as evaluated-clean for that rule's keys on that page only, so its priors resolve while every other page's findings for the same rule are untouched. The server merge itself (runCloudSmartAudits / merge-core, which apps/api imports from audit-engine) needs no change. The skip carries details.foldKey: "noindex" so a fold never mixes it with another gate's skip of the same rule, and a folded aggregate is trusted only with that key. If a rule emits no key at all in a run (every page skipped), priors carry, which is the safe direction.

Evidence

CLI from source, squirrel audit <url> --http --offline --refresh -f json, before (origin/main d279852, v0.0.103) and after (this branch rebased onto it), against fixtures served locally by a small bun server that sets the headers.

1. The issue's fixture: /meta.html (<meta name="robots" content="noindex,nofollow">), /hdr.html (X-Robots-Tag: noindex), /bot.html (X-Robots-Tag: googlebot: noindex), /a.html, and a directory listing at /. No page has an <h1> or a meta description.

-score=31 summary={'passed': 354, 'warnings': 78, 'failed': 24}
+score=31 summary={'passed': 354, 'warnings': 75, 'failed': 18}
-core/h1 [fail] h1: No H1 tag found pages=['a.html', 'bot.html', 'hdr.html', 'meta.html']
-core/meta-description [fail] meta-description: Missing meta description pages=['/', 'a.html', 'bot.html', 'hdr.html', 'meta.html']
+core/h1 [fail] h1: No H1 tag found pages=['a.html']
+core/meta-description [fail] meta-description: Missing meta description pages=['/', 'a.html']
-core/meta-title [warn] meta-title: Title too short pages=['/', 'a.html', 'bot.html', 'hdr.html', 'meta.html']
+core/meta-title [warn] meta-title: Title too short pages=['/', 'a.html']

2. A fixture where the site rules fire: an indexable homepage linking twice each to two articles that share a title, and once each to /thanks.html (meta noindex) and /thanks-hdr.html (X-Robots-Tag: noindex), which also share a title.

-score=31 summary={'passed': 373, 'warnings': 67, 'failed': 21}
+score=31 summary={'passed': 374, 'warnings': 64, 'failed': 17}
-core/h1 [fail] h1: No H1 tag found pages=['thanks-hdr.html', 'thanks.html']
-core/meta-description [fail] meta-description: Missing meta description pages=['a.html', 'b.html', 'thanks-hdr.html', 'thanks.html']
+core/meta-description [fail] meta-description: Missing meta description pages=['a.html', 'b.html']
-core/meta-title [warn] meta-title: Title too short pages=['thanks-hdr.html', 'thanks.html']
-core/title-unique [warn] title-unique: 2 duplicate title(s) affecting 4 pages pages=['a.html', 'b.html', 'thanks-hdr.html', 'thanks.html']
+core/title-unique [warn] title-unique: 1 duplicate title(s) affecting 2 pages pages=['a.html', 'b.html']
-links/orphan-pages [warn] orphan-pages: 2 orphan page(s) with <2 incoming links pages=['thanks-hdr.html', 'thanks.html']
-content/duplicate-title [warn] duplicate-title: 2 duplicate title(s) found across 4 pages pages=['a.html', 'b.html', 'thanks-hdr.html', 'thanks.html']
+content/duplicate-title [warn] duplicate-title: 1 duplicate title(s) found across 2 pages pages=['a.html', 'b.html']

3. A preview deployment: fixture 1 served with X-Robots-Tag: noindex on every response, homepage included. Before and after reports are identical (empty diff): nothing is skipped. The stored rule results show crawl/all-noindex-pages still reporting 5 page(s) blocked from indexing, and the report itself shows core/robots-meta [warn] Page is set to noindex via X-Robots-Tag header on every page, so the host-wide noindex stays visible.

4. A deep-seeded audit with a noindex entry page: audit seeded at /docs/start.html (meta noindex), the homepage answers 500, /docs/b.html is also noindex. Before and after reports are identical (empty diff): nothing is skipped, and crawl/all-noindex-pages reports 2 page(s) blocked from indexing.

5. The same deep-seeded audit with an indexable entry page: only /docs/b.html is skipped.

-score=30 summary={'passed': 220, 'warnings': 47, 'failed': 17}
+score=30 summary={'passed': 220, 'warnings': 46, 'failed': 15}
-core/h1 [fail] h1: No H1 tag found pages=['a.html', 'b.html', 'start.html']
-core/meta-description [fail] meta-description: Missing meta description pages=['a.html', 'b.html', 'start.html']
+core/h1 [fail] h1: No H1 tag found pages=['a.html', 'start.html']
+core/meta-description [fail] meta-description: Missing meta description pages=['a.html', 'start.html']
-core/meta-title [warn] meta-title: Title too short pages=['a.html', 'b.html', 'start.html']
+core/meta-title [warn] meta-title: Title too short pages=['a.html', 'start.html']

The rule cache was also checked on fixture 2 without --refresh: the second run replayed all 5 pages (pagesReplayed: 5) and its findings match the --refresh run exactly.

Tests

Re-run after the rebase onto v0.0.103: the noindex test files (noindex-skip, template-verdict-page-independence, resolution, core-robots-meta: 139 pass; noindex-skip-e2e, noindex-site-rules-dual-path, cloud-merge, rule-cache-codec, page-rule-site-context: 60 pass), tsgo --noEmit for rules, audit-engine and apps/cli, tangly check --strict, and the five CLI fixtures above. All green.

  • New packages/audit-engine/tests/noindex-skip-e2e.test.ts (12): the real adapter on BOTH engine paths (runRulesOnStorage and runStreamingRules): homepage noindex skips nothing, homepage indexable with one noindex page skips that page only, a deep-seeded audit with a noindex entry page skips nothing, a deep-seeded audit with an indexable entry page skips the noindex page, a homepage that answered 500 hands the decision to the entry page, neither fetched skips nothing. crawl/all-noindex-pages keeps listing the noindex pages.
  • packages/audit-engine/tests/cloud-merge.test.ts (+2): the server merge (runCloudSmartAudits with a signal from buildResolutionSignal). A noindex skip resolves that page's prior "No H1" while another page's stays open; a soft-404 skip (the control) carries. The noindex case fails without the resolution.ts change.
  • New packages/rules/tests/noindex-skip.test.ts (24): the pinned skip list and category exclusion, the runner gate (meta, header, googlebot-scoped header, indexable page, staging host, unknown site), noindexSource, isSiteIndexable (homepage, query page, other host, www and http, entry page by url and final url, errored homepage, bad base URL, neither fetched), the four site rules on the legacy path in all three states, and the resolution signal (that page only, folded aggregate, a real foldOverflowChecks over mixed soft-404 and noindex skips, an untyped aggregate not trusted, soft-404 still carries, no cross-rule leakage).
  • New packages/audit-engine/tests/noindex-site-rules-dual-path.test.ts (4): each site rule on the legacy and the streaming siteQuery path over one seeded store, deep-equal, in all three states.
  • rule-cache-codec.test.ts: the run context moves with siteIndexable, all three states distinct.
  • template-verdict-page-independence.test.ts: no template-scoped rule declares skipOnNoindex.
  • Existing suites green: streaming-rules-golden (v1/v2 parity), golden-baseline, page-rule-site-context, template-fanout-equivalence-golden, template-fanout-parity-golden, rule-cache-replay-golden, site-query-content-rules-golden, site-query-link-rules-golden, page-features-noindex-golden, rate-limited-pages-e2e, soft404-confirm, soft-404, resolution, rule-verdict-scope, runner-applicability, no-contextual-inbound, synthetic-site http-mode.
  • tsgo --noEmit in packages/rules, packages/audit-engine and apps/cli: clean. oxlint on the changed files adds no new errors (the remaining ones pre-date this PR). No file that was oxfmt-clean became unclean. tangly check --strict in docs/: all checks passed.

Docs

  • docs/rules/index.mdx gains a Pages kept out of search section, the one place the behavior is explained: the seven rules (linked), what counts as noindex, the homepage/start-page guard for staging and preview deployments (with a table of the three outcomes), how a skipped check shows in reports and scores, and that accessibility, security, performance and the other link rules still run.
  • core/robots-meta, crawl/indexability and crawl/all-noindex-pages each get a one-line pointer to it in their related rules.
  • CHANGELOG.md gets an ## [Unreleased] entry under ### Changed saying scores can rise for sites with noindex pages, crediting @deniskern (Index rules should skip noindex pages, and core/robots-meta should report X-Robots-Tag: noindex #457).
  • The seven rule pages each gain a paragraph saying noindex pages are skipped (or left out), naming the skipped message where there is one, and saying this happens only on a site that is itself being indexed (homepage, else entry page), with nothing skipped on a staging or preview host or when neither page was fetched, and link to the central section.

Not covered

  • Crawler-specific meta tags (<meta name="googlebot" content="noindex">) are not read by the parser, so they do not trigger the skip.
  • none (meaning noindex, nofollow) is not recognised by isPageIndexable.
  • The skip list is deliberately short. Other candidates (core/og-tags, core/canonical, content/word-count, schema/*) keep running and can be added later if the noise shows up.

@nc9
nc9 force-pushed the feat/skip-index-rules-noindex-457 branch from f751091 to ee07cd6 Compare October 5, 2026 07:56
@nc9
nc9 force-pushed the feat/skip-index-rules-noindex-457 branch from ee07cd6 to 038ff60 Compare October 5, 2026 23:06
@nc9
nc9 marked this pull request as ready for review October 5, 2026 23:19
nc9 added 2 commits October 6, 2026 10:19
A page its owner keeps out of the search index (robots meta or
X-Robots-Tag noindex, the isPageIndexable test page_features and
crawl/indexability already use) is no longer graded on how it would look
in search results:

- page rules core/meta-title, core/meta-description and core/h1 declare
  skipOnNoindex; the runner emits one skipped check (reason "noindex")
- site rules content/duplicate-title, content/duplicate-description,
  core/title-unique and links/orphan-pages leave noindex pages out, on
  both the legacy site.pages and the streaming siteQuery path

Pages are skipped only on a site known to be indexed: its homepage, or
the crawl's entry page when the homepage was not fetched, is indexable
(SiteData.siteIndexable, hashed into the per-page rule-cache run
context). A noindex homepage (a staging host, or a Vercel/Netlify/
Cloudflare Pages preview, which send X-Robots-Tag: noindex on every page)
and an unknown one skip nothing. Noindex-gated rules never fan out across
a template, and the publish resolution signal treats a noindex skip as
evaluated for that page, so a finding from before the page went noindex
resolves instead of being carried forever.

Closes #457

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the feat/skip-index-rules-noindex-457 branch from 038ff60 to f7cb71a Compare October 5, 2026 23:19
@nc9
nc9 merged commit ad7c955 into main Oct 5, 2026
14 checks passed
@nc9
nc9 deleted the feat/skip-index-rules-noindex-457 branch October 5, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Index rules should skip noindex pages, and core/robots-meta should report X-Robots-Tag: noindex

1 participant