Noindex and JavaScript in Google: what actually works
Google may skip rendering a page whose raw HTML carries noindex, so removing the tag with JavaScript may not work. Which JavaScript noindex patterns are safe.
A noindex rule in the raw HTML can stop Google from rendering the page at all, so JavaScript that would remove or rewrite that rule may never execute. Google’s JavaScript SEO documentation says: “it may skip rendering and JavaScript execution, which means using JavaScript to change or remove the robots meta tag from noindex may not work as expected.” Adding noindex from JavaScript is a different case, and Google allows it. The distinction decides which templates you can fix in the browser and which must be fixed on the server.
What the documentation actually changed
Google’s changelog entry “Clarifying noindex and JavaScript”, dated December 15, 2025, rewrote the warning. The earlier wording, as quoted by Search Engine Roundtable, said Google “skips rendering and JavaScript execution” and that “there is no chance to remove the tag from the page”. The current wording says Google “may” skip rendering, and the changelog adds: “While Google may be able to render a page that uses JavaScript, the behavior of this is not well defined and might change.” A second entry, dated December 18, 2025, covers status codes: “While pages with a 200 HTTP status code are sent to rendering, this might not be the case for pages with a non-200 HTTP status code.”
The order of operations explains why. Google handles JavaScript pages in three phases: “1. Crawling 2. Rendering 3. Indexing”. A noindex rule removes the page from the render queue before phase two: “Googlebot queues all pages with a 200 HTTP status code for rendering, unless a robots meta tag or header tells Google not to index the page.” That queue is not instant. “The page may stay on this queue for a few seconds, but it can take longer than that.”
A page that is not in the queue does not get its JavaScript executed, so a client-side change cannot be relied on to undo an exclusion that was already present in the response. Two related limits apply. Pages that return something other than 200 may not be rendered at all, per the December 18 entry. And for URLs blocked by robots.txt the doc is blunt: “Google Search won’t render JavaScript from blocked files or on blocked pages.”
The four cases
The only state that matters at crawl time is the raw HTTP response. Everything JavaScript does after that depends on Google deciding to render.
| Raw HTML state | JavaScript action | What the documentation says | Safe? |
|---|---|---|---|
| noindex present in HTML | script removes or changes the tag | rendering and execution may be skipped, so the change may not take effect | No |
| no noindex in HTML | script adds noindex | JavaScript can add a robots meta tag or change its content | Yes, if rendering happens |
| X-Robots-Tag: noindex header | none, the header is set before the page runs | a header telling Google not to index removes the page from the render queue | Yes, if exclusion is the goal |
| SPA error view returning 200 | script adds noindex | Google’s documented pattern for error pages | Yes, this is the intended use |
Case 1: noindex in raw HTML, removed by JavaScript
This is the failure that produces the support tickets. The tag ships in the server response, the page is excluded at crawl time, and the client script that was supposed to clean it up never runs. The documentation adds a direct instruction: “If you do want the page indexed, don’t use a noindex tag in the original page code.” Search Console will report the URL under Excluded by noindex tag, and repeated live tests will keep showing the tag because the tag is genuinely there, not because of a cache.
The same rule breaks preview and staging setups that rely on a client-side flag to switch indexing back on. If the production build inherits the flag from a shared environment file, the page is excluded before any JavaScript gets a chance to correct it. The recovery steps for that pattern are covered in accidentally noindexed your site.
Case 2: noindex added by JavaScript
Google permits this: “You can use JavaScript to add a robots meta tag to a page or change its content.” The risk is on the other side of the transaction. Rendering is best effort. The robots meta tag documentation states: “Google typically renders pages in order to index them, however rendering is not guaranteed.” If rendering does not happen, a noindex that only exists after JavaScript runs is never seen, and the page can be indexed despite the intent to exclude it.
That makes client-side noindex acceptable for error views and other cases where indexing is merely undesirable. It is a poor way to keep a page out of the index when exclusion is a requirement.
Case 3: noindex in the X-Robots-Tag header
The header is sent with the HTTP response, before parsing and before any script runs, so nothing in the page can edit or remove it. It also removes the page from the render queue under the same rule quoted above. That makes it the form page code cannot undo, and the hardest to debug from the front end: the page source looks clean, and the directive is invisible in the browser. Check it with the X-Robots-Tag checker and see the X-Robots-Tag guide for server and CDN configuration.
Case 4: SPA error states that return 200
Single-page apps frequently serve error views with a success status: “When a SPA is using client-side JavaScript to handle errors they often report a 200 HTTP status code instead of the appropriate status code.” Google’s recommended remedy is client-side: “Add a <meta name="robots" content="noindex"> to error pages using JavaScript.” The sample code carries a precondition: “This example assumes there is no other robots meta tag present in the HTML.”
That is the one case where the documentation endorses the pattern the rest of this article warns about. The difference is intent: the page should not be indexed, and the alternative, a soft 404 or a duplicate error view, is worse.
How this happens in real stacks
The mechanisms are predictable, and they are all variations on one problem: a tag that belongs in the response is being managed in the component tree.
A shared SEO component with a preview flag. Head managers such as Next.js metadata, React Helmet, Nuxt useHead and Angular’s Meta service can set the robots directive from data. A noindex value driven by an environment variable, a CMS field, or a launch checklist item leaks into a production template. If the server renders that value, the raw HTML carries the tag. Turning it off later on the client is case 1.
A server-rendered loading shell. A route responds with a skeleton and a noindex tag, then hydration replaces the content. When a CDN or page cache stores the shell and serves it to Googlebot, the response that arrives at crawl time is the excluded one. The application code is correct and the cache is the bug.
An error boundary that rewrites the head. The router catches a failure, the error component injects noindex, and the URL still returns 200. This is case 4 and matches the documentation. It becomes a problem only when the boundary misfires on valid content and the tag sticks.
Canonicals toggled at runtime. The same hazard applies to canonical tags, and Google states the rule plainly: “you shouldn’t use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML.” Canonicalization runs at more than one stage: “Canonicalization happens before and after rendering”. A client-side canonical that disagrees with the raw HTML creates a conflict rather than a correction.
How to check raw versus rendered
Start with the response, not the browser. This shows what Googlebot receives and whether the tag is already present:
curl -sS -D headers.txt -o page.html https://example.com/page
grep -i '^x-robots-tag' headers.txt
grep -io '<meta[^>]*name="robots"[^>]*>' page.html
Then compare with what Google sees after rendering. The documentation’s instruction is: “use the Rich Results Test or the URL Inspection Tool and look at the rendered HTML.” URL Inspection shows “loaded resources, JavaScript output, and other information”, but “A screenshot of the rendered page is available only in a live test.” When you need the exact bytes Googlebot received during a crawl, the guidance is to “use the URL Inspection tool to see the HTML that Googlebot received while crawling the page”, because “We have to crawl your page in order to see <meta> tags and HTTP headers.”
Three tools cover the same ground faster. The indexability checker and the X-Robots-Tag checker read raw HTML and headers with no JavaScript rendering, which is exactly the state that decides case 1. The crawler diff checker compares what Googlebot and a browser receive.
stillindexed works the same way: it fetches the raw response over plain HTTP with no JavaScript rendering, every 30 or 15 minutes depending on the plan, so it catches a noindex that ships in the HTML. That is the failure you cannot recover from the client. The trial covers 3 sites for 30 days with no card required.
What to do instead
- Set the index state in the response. Emit the robots meta tag, or the header, from the server or edge layer that knows the environment. Treat any client-side toggle as decoration, not as control.
- Server-render or prerender the routes you care about. Google’s own recommendation: “it makes your website faster for users and crawlers, and not all bots can run JavaScript.”
- Keep canonical decisions in one place. Do not let a head manager overwrite the canonical in the browser, because canonicalization is evaluated before and after rendering.
- For error views that return 200, keep the documented JavaScript noindex, and verify that the HTML contains no other robots meta tag that would conflict with it.
- Avoid toggling
data-nosnippetat runtime for the same reason: “Google typically renders pages in order to index them, however rendering is not guaranteed”, and Google says “do not add or remove thedata-nosnippetattribute of existing nodes through JavaScript.” - Add a post-deploy check of raw HTML for each template, including error and preview routes. The post-deploy SEO checklist puts that step in order.
Sources
- Google’s JavaScript SEO basics, including the noindex warning and the error-page pattern.
- Google’s Search Central documentation updates, for the December 15 and December 18, 2025 entries.
- Google’s Fix Search-related JavaScript problems, for SPA status codes.
- Google’s robots meta tag specification, for “rendering is not guaranteed” and data-nosnippet.
- Google’s Block Search indexing with noindex.
- Search Console Help, URL Inspection tool.
- Coverage of the change: Search Engine Roundtable and Search Engine Journal, both December 2025.
Read next
Questions
- Does noindex work if added by JavaScript?
- Yes, Google says you can use JavaScript to add a robots meta tag to a page. The caveat is that rendering is not guaranteed, so a page that relies on client-side JavaScript for its noindex may still be crawled and indexed if Google does not render it. Server-side noindex is more reliable.
- Can JavaScript remove a noindex tag?
- Google warns that it may not work. A noindex rule in the original HTML can take the page out of the render queue, which means Google may skip rendering and JavaScript execution entirely. The script that removes the tag never runs, and the page stays excluded. Put the page in the state you want in the raw HTML.
- Can JavaScript override an X-Robots-Tag noindex header?
- No. The header is part of the HTTP response and is processed before the page's JavaScript runs, so page code cannot edit or remove it. Only the server or edge configuration that sets the header can change it. If you need the page indexed, remove the header at the source.
- How do I check whether a noindex is in the raw HTML or added later?
- Fetch the URL with curl and read the response body and headers. That is what Googlebot receives before rendering. Then run the URL in Search Console's URL Inspection tool and inspect the rendered HTML to see what JavaScript added. The indexability checker reads raw HTML only, which is the state that decides whether rendering is skipped.