JavaScript SEO: CSR, SSR and Dynamic Rendering

The modern web is built on JavaScript frameworks (React, Vue, Angular) that make websites fast and interactive (Single Page Applications or SPAs). However, this technological evolution has created a gulf between developers and SEO professionals. If your content is loaded after the initial page load via JS, Googlebot might never see it.

In this Technical SEO guide for JavaScript, we will analyze the rendering problem, the computational costs for search engines, and definitive architectural solutions to index SPAs correctly.

1. Googlebot's Rendering Process

Contrary to popular myth, Googlebot does execute JavaScript. The problem is not whether it executes it, but when and at what cost.

Google's indexing process is split into two waves (Two Waves of Indexing):

  • First Wave (Crawl & Parse): Googlebot downloads the raw HTML of the page. Everything present in this initial HTML is extracted, processed, and indexed almost instantaneously. If your page is an empty box waiting for JS to populate it (e.g. <div id="root"></div>), Google sees an empty page and leaves.
  • Second Wave (Render & Execute): Pages requiring JavaScript execution are put into a secondary rendering queue (WRS - Web Rendering Service). Running JS code costs Google enormous electrical energy and machine time. This queue can last days or even weeks.

Delayed Indexing

If you publish breaking news or a time-limited offer using Client-Side Rendering, the content might not enter Google's index in time to be useful to users.

2. Client-Side (CSR) vs. Server-Side Rendering (SSR)

Understanding your site's technical architecture is the fundamental step in solving JS indexing issues.

ArchitectureHow It WorksSEO Impact
Client-Side Rendering (CSR)The browser downloads an empty HTML and a JS bundle. The JS fetches data via APIs and 'draws' the page.Very high SEO risk. Indexing delays. Meta tags and titles are often missing in the first wave.
Server-Side Rendering (SSR)The HTML is fully generated on the server (e.g. Node.js, Next.js) and sent already compiled to the browser.Great for SEO. Googlebot receives text, links, and meta tags immediately. Faster response time (TTFB).
Static Site Generation (SSG)Pages are pre-generated as HTML during the build phase (Gatsby, Next.js static export).Perfect for SEO and Core Web Vitals. Ideal for blogs and e-commerce with stable catalogs.

3. The Compromise: Dynamic Rendering

If you have an existing app built in pure React and do not have the budget to rewrite it in Next.js (SSR), the historically recommended workaround was Dynamic Rendering.

  • How it works: Your server intercepts the HTTPS request's User-Agent. If it's a normal user (Chrome, Safari), you serve the fast client-side React app. If the User-Agent is Googlebot or Bingbot, you route the request to a service (like Rendertron or Prerender.io) that executes the JS on the server and spits out static HTML for the crawler.
  • Current Status: Google has recently discouraged Dynamic Rendering as a long-term solution, calling it a "temporary band-aid" and suggesting migrating to SSR, SSG, or progressive hydration.

4. Critical JS Elements (Meta and Links)

Even if your JS works perfectly for the user, Googlebot needs well-defined HTML standards.

  • Links must be <a href>: Bots do not "click" on buttons to execute onclick events. They only follow URLs written in the href attributes of anchor tags.
  • Meta Tags in Head: React Helmet and similar libraries can inject Title and Description tags into the DOM after the fact. However, if social meta tags (Open Graph) are not in the native HTML, platforms like LinkedIn, X, and WhatsApp will never show the article preview when sharing the link.
Wrong (Not crawlable):
<div onclick="window.location='/page'">Click here</div>

Correct (Crawlable):
<a href="/page">Click here</a>

Conclusions: Inspect and Prevent

The golden rule of technical SEO in the React era is: "Trust, but verify". You must stop viewing your site only as you see it in the browser. Turn off JavaScript or use a headless emulator to see exactly the raw HTML your server spits out initially. If that raw HTML doesn't contain your H1 heading and paragraph text, you have a major SEO barrier.

Strumenti Correlati

About the Author: Nicola Selenu

Nicola is a Lead Developer and Digital Marketing Technologist with years of hands-on experience in technical SEO, web analytics, and deliverability. He builds tools to bridge the gap between complex marketing technicalities and easy-to-use solutions.