Get a free consultation
Website Design

JavaScript SEO in 2026: Five Rules Google Has Now Made Explicit

By Sigmato Editorial TeamUpdated 15 Nov 20266 min read

Close-up of a laptop screen displaying programming code with a cute plush toy reflecting.

Key takeaways

  • Google can render JavaScript, but its guidance is clear that important signals should be in the HTML the server sends, not added later by script.
  • Do not use JavaScript to remove a noindex tag. If Google sees noindex, it may skip rendering altogether.
  • Pages with a non-200 status code may not be sent to rendering, so return 200 for any page you want indexed.
  • Set the canonical URL in the HTML. If JavaScript touches it, it must match.
  • Links must be real <a> elements with an href. Server-side rendering or pre-rendering is still recommended.
Close-up of a laptop screen displaying programming code with a cute plush toy reflecting.

What changed in Google’s documentation

Google rewrote parts of its JavaScript documentation between August 2025 and March 2026. None of it is a new ranking rule. It is Google spelling out behaviour that developers often learned by trial and error. The dated entries in Google’s documentation changelog are:

Date What the documentation now says
28 Aug 2025 New guidance on JavaScript-based paywalls, which can make it hard for Google to identify paywalled content.
15 Dec 2025 A noindex tag in a JavaScript-driven page has undefined behaviour.
17 Dec 2025 Canonicalization best practices for JavaScript were added.
18 Dec 2025 Pages with non-200 status codes may not be sent to rendering.
4 Mar 2026 An outdated accessibility section was removed from the JavaScript SEO basics page.

If you build with React, Next.js, Vue or Angular, these notes matter because the usual bugs live in exactly these places.

How Google handles a JavaScript page, briefly

Google crawls the HTML first. Pages with a 200 status go to a rendering queue, and when resources allow, a headless Chromium runs the JavaScript and Google processes the result. The page can wait in the queue “a few seconds”, and sometimes longer. Two practical consequences follow: content that only exists after JavaScript runs is indexed later than HTML content, and Google does not render JavaScript from files or pages you have blocked.

Rule 1: Do not use JavaScript to remove noindex

Google’s documentation says that when it encounters a noindex tag it may skip rendering and JavaScript execution. So the pattern “ship noindex in the HTML and let a script remove it” cannot be relied on. If you want a page indexed, leave noindex out of the original HTML.

The reverse is better: render your real robots rules on the server. In the Next.js App Router, for example:

// app/staging-preview/page.tsx
export const metadata = {
  robots: { index: false, follow: false },   // server-rendered in the HTML head
};

Rule 2: Indexable pages must return 200

Google sends pages with a 200 status to the rendering queue. For other status codes, rendering “might be skipped”. Make sure the pages you want indexed respond with 200 and a complete document. This catches a surprising number of projects where a framework returns a placeholder shell with a 404, or where a client-side route returns 200 for a page that does not exist (see rule 5).

Rule 3: Set the canonical in the HTML

Google says you should not use JavaScript to change the canonical URL to something other than the URL you specified. Where possible, put rel="canonical" in the server-rendered HTML. If a script also writes it, the value must match, and the page must never end up with two canonical tags.

// Next.js App Router
export const metadata = {
  alternates: { canonical: 'https://example.com/services/web-design/' },
};

Use an absolute URL, and keep a self-referencing canonical on the canonical page itself.

Google “can only discover your links if they are <a> HTML elements with an href attribute”. Navigation built from buttons, divs or click handlers without a real href is invisible to crawling.

<!-- Crawlable -->
<a href="/services/web-design/">Web design</a>

<!-- Not crawlable -->
<div onclick="router.push('/services/web-design/')">Web design</div>
<a onclick="go('web-design')">Web design</a>

In a framework, use its link component, which renders a normal anchor with an href.

Rule 5: Avoid soft 404s in single-page apps

If your app handles routing in the browser, a missing page can still return a 200 status with an error message on screen. Google calls these soft 404s and gives two ways to avoid them:

  • redirect with JavaScript to a URL where the server returns a real 404, or
  • add a noindex robots meta tag to the error view with JavaScript.

The cleaner fix is to render the error on the server with the correct status code. In Next.js, the notFound() function does this for missing data.

One more habit: real URLs, not fragments

Google advises against using fragments (the part after #) to load different content. Use the History API so each view has a real path.

Google says server-side rendering or pre-rendering “is still a great idea because it makes your website faster for users and crawlers”, and notes that not all bots can run JavaScript. If you are choosing a stack, read our comparison of Next.js vs React and our notes on headless CMS. Structured data injected with JavaScript is supported, but test it after every change.

How to test your own pages

  1. View the raw HTML. Run curl -s https://example.com/page/ and check the title, canonical, robots tag, main heading and key links are in the first response.
  2. Check the status code. curl -sI https://example.com/page/ should show 200 for indexable pages and a real 404 for missing ones.
  3. Use URL Inspection. In Search Console, compare the crawled HTML with the rendered result and the screenshot.
  4. Do not block your scripts. Confirm robots.txt does not block the JavaScript and CSS files your pages need.
  5. Test with JavaScript off. If the page is empty or the navigation vanishes, crawlers that do not run script see the same thing.

A developer’s pre-launch checklist

  • Server-rendered title, description, canonical and robots tag on every template.
  • No script that removes noindex or rewrites the canonical.
  • Real <a href> links everywhere in navigation, pagination and lists.
  • Correct status codes for 404, 410, redirects and server errors.
  • Meaningful URLs through the History API, with no hash routing.
  • Sitemaps listing real, indexable, canonical URLs.
  • No important content that appears only after a click, scroll or login.

If you are building or rebuilding a React or Next.js site and want this checked before launch, our team builds exactly this kind of Next.js application, and you can talk to us about a technical SEO review.

Frequently asked questions

Does Google render JavaScript?

Yes. Pages with a 200 status go to a rendering queue and a headless Chromium runs the JavaScript when resources allow. Content that depends on JavaScript can be indexed later than content in the HTML.

Can I remove noindex with JavaScript?

You should not rely on it. Google says it may skip rendering when it sees noindex, so a script that removes the tag may never run. Leave noindex out of the original HTML if you want the page indexed.

Do error pages get rendered?

Not necessarily. Google says rendering might be skipped for pages with non-200 status codes, so always return 200 for pages you want indexed and a real 404 for pages that do not exist.

Should I set the canonical with JavaScript?

Set it in the HTML where you can. If JavaScript also writes it, the value must match the HTML and the page must never have multiple canonical tags.

Is server-side rendering still worth it?

Yes. Google says server-side rendering or pre-rendering makes sites faster for users and crawlers, and notes that not all bots can run JavaScript.

Sources and further reading

Sigmato Editorial Team

Written by

Sigmato Editorial Team

The Sigmato Editorial Team is made up of software engineers, UI/UX designers and AI specialists at Sigmato Solutions Pvt Ltd in Bengaluru, India and the UK. We write practical guides on web, mobile, cloud and AI development, drawing on the products we design and build for startups and enterprises worldwide.

Last updated 15 November 2026 · Talk to our team