Skip to content

Add noindex header to versioned docs subdomains - #2087

Merged
taras-yemets merged 2 commits into
mainfrom
taras/noindex-version-subdomains
Oct 12, 2026
Merged

taras-yemets merged 2 commits into
mainfrom
taras/noindex-version-subdomains

Conversation

@taras-yemets

@taras-yemets taras-yemets commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Google indexes old docs versions, such as 6.5.sourcegraph.com/deep-search (reported in Slack). These pages outrank sourcegraph.com/docs for "deep search". They have a canonical link to sourcegraph.com/docs, but Google treats a canonical as a hint, not a rule.

This PR sends X-Robots-Tag: noindex, nofollow on hosts like 6.5.sourcegraph.com. It does not affect sourcegraph.com/docs.

Why it happened

Each version branch in sourcegraph/docs-legacy-versions is a copy of main. main has no noindex rule for versioned subdomains. So each version only has what was added to it by hand, or what main had when the branch was cut:

Versions Today Google
5.2–6.1 noindex, nofollow meta tag, added to these branches only Does not index
6.2–6.10 No robots.txt, no noindex Can index
6.11–7.0 robots.txt Disallow: / from #1480 Cannot crawl, so cannot see a noindex
7.1–7.7 robots.txt Allow: / since #1718, no noindex Can index

Plan

  1. Merge this PR. Version branches cut from main later get the header.
  2. Cherry-pick this commit to v6_2–v7_7 in sourcegraph/docs-legacy-versions. On v6_11, v6_12 and v7_0, also change robots.txt to Allow: /, so Google can see the header.
  3. Check that each subdomain sends X-Robots-Tag: noindex, nofollow.
  4. In Google Search Console, request removal of the versioned subdomains. This hides them from results while Google crawls them again.

Test plan

  • The host pattern matches 6.5.sourcegraph.com and 6.12.sourcegraph.com. It does not match sourcegraph.com, www.sourcegraph.com, or *.vercel.app (checked in Node).
  • After merge: sourcegraph.com/docs has no X-Robots-Tag header.

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

This comment has been minimized.

Old docs versions on X.Y.sourcegraph.com are indexed by Google.
Send X-Robots-Tag: noindex on those hosts.
sourcegraph.com/docs is not affected.
@taras-yemets
taras-yemets force-pushed the taras/noindex-version-subdomains branch from 5d12bbe to 23b8e3b Compare October 12, 2026 10:19
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Oct 12, 2026 10:30am UTC

Request Review

Matches the noindex, nofollow meta tag on 5.2–6.1.
@taras-yemets
taras-yemets marked this pull request as ready for review October 12, 2026 10:56
@taras-yemets
taras-yemets merged commit 1cab47e into main Oct 12, 2026
11 checks passed
@taras-yemets
taras-yemets deleted the taras/noindex-version-subdomains branch October 12, 2026 10:56
@jdorfman

Copy link
Copy Markdown
Member

Thank you!

This branch was successfully deployed

1 active deployment
Preview — 41b0da5a Deployed Oct 12, 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.

3 participants