JavaScript SEO And Prerendering: What Crawlers Actually See
A page can pass every manual check in a browser and still be invisible to a crawler, because the browser and the crawler receive different HTML. This post explains where in the rendering pipeline that divergence happens, which of the six real-world rendering setups you actually have, and what changes to your architecture or your templates will move the needle without a full replatform. The short answer is that rendering strategy is rarely the root cause on its own; it is more often the reason a genuine indexation problem stays hidden until you go looking for it.
The pipeline, in four stages
Any URL you serve goes through the same four stages. The stage that matters is the one where HTML is produced.
| Stage | What is produced | Who sees it |
|---|---|---|
| Discovery | A link, a sitemap entry, a redirect | Crawler |
| Fetch | Status code, headers, robots directives | Crawler |
| Render | Executed DOM after JavaScript runs | Crawler, optionally in two waves |
| Index | Google's judgement of the rendered result | Searcher |
The third stage is where the trouble starts. Google's crawler will render JavaScript, and has done so at scale for years, but it does so under conditions that differ from a user's browser in ways that matter commercially:
- Rendering is deferred. There is no guarantee that the deferred rendering happens at all, on any given day, for any given URL set.
- Rendering is resource-capped. Google's renderer prioritises. A site that produces tens of thousands of pages a second will have a far lower proportion rendered quickly than a site that produces twenty.
- Deferred rendering is separate from the initial fetch. A page can be indexed at stage three without ever appearing in your server logs, which makes log analysis a poor tool for this.
- The bot that renders is not the bot that fetches. Googlebot renders; Googlebot Smartphone renders on a mobile viewport with a slower CPU budget and a memory ceiling. A page that renders on desktop and times out on mobile is not indexed.
A crawler rendering your page is a courtesy, not a contract. Build the page so that the first response is already correct and the second wave is a refinement.
The two populations
The single most useful diagnostic question is whether your users and your crawler are receiving the same document. If the answer is no, everything downstream is guesswork.
| Symptom | User sees | Crawler sees |
|---|---|---|
| CSR without fallback | Full page | Empty shell, script tags |
| CSR with skeleton | Full page after 800 ms | Skeleton copy |
| SSR | Full page | Full page |
| SSG | Full page | Full page |
| Streaming SSR | Full page, progressive | Partial HTML, then chunks |
The row that generates most support tickets is the first. A React or Angular single-page app with no server rendering sends a document that is, structurally, an empty container. Everything Google eventually indexes, it indexes because it decided to spend a render on it, not because your server gave it anything.
Why view-source is not a test
The most common failing test in this area is opening view-source in a browser and concluding the page is fine, because the browser has helpfully re-fetched and executed the scripts before rendering the view. That proves your JavaScript works. It proves nothing about what was on the wire.
The tests that do carry information:
| Test | What it tells you | What it does not tell you |
|---|---|---|
curl the URL, read the body | What the server actually sent | Whether the render was deferred |
| URL Inspection, live test | Whether Google rendered it on demand | Whether it will render for 400,000 URLs |
| Rendered HTML versus raw HTML byte count | How much content is script-only | Which is more relevant |
| Render a sample from each URL pattern | Pattern-level behaviour | Per-URL behaviour |
The row that catches most cases is the last one. A site can have a home page that prerenders perfectly and a product template that does not, and the difference is invisible until you sample by template rather than by site.
What prerendering actually means
Prerendering means the HTML for a specific URL is generated at build time or on a cache fill, and served as the document. It is not a separate system; it is a change to when the same rendering work happens.
The difference between prerendering and server-side rendering in practice is where the cache sits, and that decides almost everything about cost and correctness:
// Client-side render: the document arrives empty, work happens in the browser
fetch('/product/12345')
.then((r) => r.json())
.then((data) => renderProduct(data));
// Prerender on demand: first request renders, second is served from cache
app.get('/product/:id', async (req, res) => {
const cacheKey = `product:${req.params.id}`;
const cached = await cache.get(cacheKey);
if (cached) {
res.type('html').send(cached);
return;
}
const html = await renderTemplate({ id: req.params.id });
await cache.set(cacheKey, html, { ttl: 3600 });
res.type('html').send(html);
});
The trade-off is freshness. Cached HTML goes stale, and stale HTML on a product page is a commercial problem, not merely a ranking one. Cache TTLs should be driven by how fast the underlying data changes, not by a global default.
The options, honestly ranked
| Approach | Crawler cost | Freshness | Infrastructure cost | Fit |
|---|---|---|---|---|
| Static generation | Lowest | Build-time only | Lowest | Content, docs, marketing |
| Prerender with cache | Low | TTL-bound | Medium | Large catalogues, product pages |
| Server-side render | Medium | Request-time | Highest | Personalised, frequently changing |
| Streaming SSR | Medium | Request-time | High | Sub-second TTFB matters |
| Dynamic rendering | Medium | Request-time | Medium | Legacy escape hatch |
| Client-side render | Highest for the crawler | Perfect | Lowest | Almost never correct for indexable pages |
Dynamic rendering deserves a specific warning. Serving a pre-rendered snapshot to bots and the real app to users is explicitly something Google has said it will not indefinitely support, because it presents a different page to the crawler than to the user. It still works in the wild because enforcement is uneven, but building a plan on it is building on a borrowed timeline.
The indexation trap nobody plans for
Rendering is rarely the indexation problem. It is more often the thing that makes one invisible, and there is a specific failure pattern worth naming.
A JavaScript-driven site with a filter system produces one URL pattern that renders, and four more that do not. The four unrendered patterns still return HTTP 200, still return valid HTML, and still appear in the sitemap. From the outside they look healthy. Google fetches them, spends nothing on rendering because the heuristics say they are low-value, and files them under "crawled, currently not indexed" — a verdict that gets misdiagnosed as a content quality problem for months.
The fix is architectural rather than editorial. If a URL pattern is not meant to be indexed, say so in the first response:
HTTP/2 200
X-Robots-Tag: noindex, follow
Cache-Control: public, max-age=600
If it is meant to be indexed, the HTML that arrives must contain the title, the canonical and the body copy. Both of those are decisions about templates, and neither of them requires anyone to run a render.
What does not work
Adding a prerender library and leaving the template alone. Most prerendering libraries inject content into a container element and leave the document's head generated by the framework's client runtime. You get a body and no head, which is half a solution.
Blocking on render before responding. A server that waits for the client bundle to render before it returns anything trades one SEO problem for a performance problem. Crawlers get the content, and users get a slow first byte. Streaming SSR exists because this trade is avoidable.
Treating a render check as a template check. Passing a rendering test on one URL tells you about one URL. Templates drift, and the facet you never tested is the one generating forty thousand URLs.
Assuming Googlebot will keep rendering. It renders now. The business case for a prerendered first response is that it is correct regardless of whether any crawler ever executes a line of JavaScript again, which is a much more comfortable place to stand.
Where to start
Fetch ten URLs per template with curl and read the bodies. If the body does not contain the product name, the price, or the main copy, you have your answer, and you have it in about four minutes without a single tool subscription.
Then decide per template whether the content is indexable at all, and answer that in the first response rather than in the second. Where it is indexable, move the HTML generation to build time or to a cache fill. Where it is not, an X-Robots-Tag header is cheaper and more reliable than a meta robots tag, because it does not depend on the parser reaching the right element.
When the templates are fixed, measure what the change actually moved. The site configuration guide covers crawl scope and rendering-sensitive settings, and running and monitoring crawls is where you set up the repeated sampling that stops this regressing quietly. For the pattern-level view of which templates produce which verdicts, triage and pattern analysis is the section to read next.