How a staging noindex reaches production
One tag keeps staging out of search. The same tag on production removes your pages from it. The four ways it gets there, and how to catch it.
Keeping a staging site out of search is good practice. The usual way is one instruction, noindex, on every page. The trouble starts when the same instruction is served by production: it works exactly as designed, and search engines remove the pages.
The two places it lives
Search engines read noindex from two places, and either one is enough.
<meta name="robots" content="noindex">X-Robots-Tag: noindexThe header is the one that hides. It is not in any template, it does not show when you view the page's source, and it also applies to files that have no <head> at all, like PDFs and images.
Four ways it ships
- An environment variable with the wrong value. The template says "add noindex unless this is production", and the production build runs without the variable that says so.
- Configuration copied between environments. A server or hosting setting from staging is promoted along with the code.
- A switch in the CMS. Many systems have a "discourage search engines" setting. It is turned on before launch and is still on after it.
- A rule at the edge. A header rule written for preview hosts matches the production host too, because the pattern was wider than intended.
What happens next
Nothing, at first. A search engine has to crawl a page again to see the instruction, so pages leave the results one by one over days or weeks, the most visited first. Once the tag is removed, each page has to be crawled once more before it can return.
How to catch it
- After a deploy, request a few important pages and read both the HTML and the headers.
- Compare with the last known good state. Some pages should be noindex: search results, account pages, thin archives. The signal is a page whose answer changed.
- Check the sitemap against the pages. An address listed in the sitemap that says noindex is a contradiction, and one of the two is wrong.
curl -sI https://example.com/pricing | grep -i x-robots-tag
curl -s https://example.com/pricing | grep -i 'name="robots"'With Ranky
Ranky reads both the meta tag and the header on every page it crawls. A page that turns noindex is reported with the deploy that brought it in, and a noindex on the home page is treated as worse than one on an archive page. It also reports a sitemap that lists a noindex page, and a canonical that points to one.
The full list is in Checks, and Alerts covers who is told and where.
