Skip to content

Make robots.txt and the sitemap unable to contradict each other - #87

Merged
fosterwei merged 1 commit into
mainfrom
fix/robots-check
Sep 30, 2026
Merged

fosterwei merged 1 commit into
mainfrom
fix/robots-check

Conversation

@fosterwei

Copy link
Copy Markdown
Owner

The file itself was already correct: 200, text/plain, Allow: /, and a Sitemap line on the www host after the canonical fix. Nothing needed changing in what it says. What was missing is anything stopping it from going wrong.

Why this needed a check

robots.txt and sitemap.xml are generated in two different files and nothing compared them. A Disallow that blocks a URL the sitemap advertises is the one SEO mistake that silently removes pages from search while every other check here still passes: the build succeeds, the links resolve, the pages render, the sitemap validates.

The rule

Every sitemap URL is tested against the wildcard group's Disallow rules, with * expanded, and the Sitemap line must name the origin the sitemap actually uses.

Verified by injecting five faults:

Injected Caught
Disallow: /compounds/ yes, 30 URLs named
Disallow: /*/bpc-157 yes, 4 URLs
Sitemap line on a vercel.app host yes
No Sitemap line at all yes
Disallow under User-agent: GPTBot no, correctly

The last one is the case it must not flag. A rule for a named crawler is a deliberate decision about that crawler, not a contradiction.

Why nothing is disallowed

The generator now explains this, because the reasoning is not obvious and the natural instinct is the wrong one.

The pages this site keeps out of search are kept out with a noindex meta tag, and that only works if a crawler is allowed to fetch the page and read it. Disallowing the seven unwritten records would mean the tag is never seen, and the URLs could still be indexed from links pointing at them, with no description. /_astro must stay fetchable or Google cannot render the pages at all.

Also checked, all clean

Check Result
Apex robots.txt 308 to www
Trailing-slash URLs 308 to the canonical form
.html duplicates Vercel serves 200, but canonical points at the clean URL, so they consolidate
404 for a missing page 404 status, noindex, follow

Gates

Content validation (59 records), 36 drafter tests, 17 calculator tests, loop gate 47/47, all seven link rules.

🤖 Generated with Claude Code

The file itself was already right: 200, text/plain, Allow: /, and a
Sitemap line on the www host after the canonical fix. Nothing needed
changing in what it says. What was missing is anything stopping it from
going wrong.

The two files are generated in different places, robots.txt.ts and
sitemap.xml.ts, and nothing compared them. A Disallow that blocks a URL
the sitemap advertises is the one SEO mistake that silently removes
pages from search while every other check here still passes: the build
succeeds, the links resolve, the pages render.

check_links.py gains a seventh rule. Every sitemap URL is tested against
the wildcard group's Disallow rules, with * expanded, and the Sitemap
line must name the origin the sitemap actually uses. Verified by
injecting five faults: a plain prefix Disallow (caught 30 URLs), a
wildcard Disallow (4), a Sitemap line pointing at a vercel.app host, and
no Sitemap line at all. The fifth is the one it must not catch, a
Disallow under a named user-agent rather than the wildcard, which is a
deliberate choice about one crawler and not this check's business.

The generator now says why nothing is disallowed, because the reasoning
is not obvious and the natural instinct is wrong. The pages kept out of
search are kept out with a noindex tag, which only works if the crawler
is allowed to fetch the page and read it. Disallowing the seven
unwritten records would mean the tag is never seen and the URLs could
still be indexed from links, with no description. /_astro must stay
fetchable or Google cannot render anything.

Also checked and found clean: the apex host redirects robots.txt to www,
trailing-slash URLs 308 to the canonical form, and the .html duplicates
that Vercel serves carry a canonical pointing at the clean URL, so they
consolidate rather than compete.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
research-reference Ready Ready Preview Sep 30, 2026 8:26am UTC

@fosterwei
fosterwei merged commit 2cb657d into main Sep 30, 2026
5 checks passed
@fosterwei
fosterwei deleted the fix/robots-check branch September 30, 2026 08:27

This branch was successfully deployed

1 active deployment
Preview — f04e16d6 Deployed Sep 30, 2026 by vercel[bot]
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.

1 participant