fix: keep API JSON out of Google results - #160
Merged
Merged
Conversation
Google had started indexing /api/v1/*.json endpoints (18 URLs in Search Console). Those are machine payloads, not pages, and they dilute the crawl budget that should go to the model, provider and parameter pages. Serve /api/v1 with X-Robots-Tag: noindex (vercel.json for prod, an Express middleware for dev/test parity) and drop rel="nofollow" on every internal link to a .json endpoint. The endpoints stay public and crawlable on purpose: a robots.txt Disallow would hide the noindex and strand the already-discovered URLs in the index. Also adds /api, the HTML docs page, to the sitemap. It was canonical and indexable but missing from it.
|
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.
💭 Why
Search Console shows Google crawling 18
/api/v1/*.jsonURLs. Those are machine payloads, not pages. They add nothing in search results and eat crawl budget that should go to the model, provider and parameter pages.✨ What changed
/api/v1/*now returnsX-Robots-Tag: noindex(vercel.json for prod, Express middleware for dev/test parity)..jsonendpoints getrel="nofollow"(model page, footer, "How to use" panel)./api, the HTML docs page, added to the sitemap. It was indexable but missing.buildRobotsTxthelper, so the crawl policy is tested instead of inlined in the build script.👤 For users
Nothing changes. Every endpoint stays public, CORS-enabled and fetchable. Only search engines are asked to skip them.
📝 Notes
robots.txt deliberately does not
Disallow: /api/. Blocking the crawl would hide the noindex header and leave the 18 URLs stuck in the index as bare links. They need to be crawled once more to be dropped.Deindexing takes a few weeks. Worth re-checking Search Console after the next crawl.