feat(seo): noindex LLM text endpoints - #92
Merged
Conversation
The plain-text mirrors of the docs were competing with the HTML pages they duplicate: /llms-full.txt alone earned 37,527 Search impressions (18% of the site's total) at position 17.9 with a 0.03% CTR, which drags the whole site's CTR baseline down and puts a raw text dump in front of human searchers. Send X-Robots-Tag: noindex on every alternate-format endpoint: /llms.txt and its per-section copies plus /AGENTS.md via headers() in next.config.mjs, and /llms-full.txt plus the /llms.mdx route (which also backs every .md-suffixed docs URL) from the route handlers that build those responses. Crawling is untouched: robots.txt still allows everything, so agents fetch these as before and only indexing is suppressed. Header matching happens on the requested path, so the homepage keeps its own headers when middleware rewrites it to /AGENTS.md for markdown clients. No HTML page gets noindex.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The plain-text mirrors of the docs are ranking against the HTML pages they duplicate. Search Console shows
/llms-full.txtwith 37,527 impressions (18% of the site's total) at average position 17.9 and a 0.03% CTR: a raw text dump shown to human searchers, dragging the site-wide CTR baseline down.Change
X-Robots-Tag: noindexon every alternate-format endpoint, using whichever mechanism owns the response:/llms.txtand per-section*/llms.txtheaders()innext.config.mjs(static files inpublic/)/AGENTS.mdheaders()innext.config.mjs/llms-full.txtapp/llms-full.txt/route.ts)/llms.mdx/*and every.md-suffixed docs URLapp/llms.mdx/[[...slug]]/route.ts), which middleware rewrites.mdURLs intoCrawling is untouched:
robots.txtstill allows everything and noDisallowwas added, so agents keep fetching these exactly as before. Only indexing is suppressed./AGENTS.mdgets its header fromnext.config.mjsrather than from its route handler on purpose. Middleware rewrites/to/AGENTS.mdfor markdown and programmatic clients, and header matching happens on the requested path, so the homepage keeps its own headers instead of inheritingnoindex. No HTML page is noindexed.Test evidence
TDD: the two new header assertions in
tests/e2e/llm-endpoints.test.tsfailed first (x-robots-tagwasnull), then passed after the implementation. A third test pins the homepage as indexable even when it negotiates markdown.bun test tests/e2e/llm-endpoints.test.ts: 14 pass, 0 failbun test(full suite): 230 pass, 0 failbun run lintclean,bun run typecheckcleanManual probe against
next devwith the generatedllms.txtfiles present: