Skip to content

Rendering

Prerendering

Generating static HTML snapshots of JavaScript-rendered routes for crawlers and (sometimes) users.

Definition

Prerendering closes the gap between a JavaScript-rendered application and crawler-facing HTML. A prerender service runs the page in a headless browser, captures the fully rendered HTML, and serves it from cache. Used to make SPAs and JS-heavy SSR sites reliably indexable by search and AI crawlers without rewriting the rendering pipeline.

When to use

  • Single-page applications (React, Vue, Svelte) where the initial HTML is empty until JS executes.
  • Server-rendered sites where the server-rendered HTML still depends on client-side hydration for visible content.
  • Sites that need to serve different (faster, cached) HTML to bots than to humans, without cloaking.
  • Teams that cannot afford a full SSR/SSG rewrite but need crawler-reliable HTML in weeks, not quarters.

Common pitfalls

  • Caching prerendered HTML too aggressively, so updates take hours or days to reach crawlers.
  • Routing only Googlebot through prerender while leaving GPTBot, ClaudeBot, and PerplexityBot on the JS-only path.
  • Returning a prerendered HTTP 200 for soft-404 routes, which inflates the indexable surface with empty pages.
  • Forgetting to keep `<link rel="canonical">` and JSON-LD consistent between prerendered HTML and the runtime client view.

Verification

  • curl -A "Googlebot" https://your-site.com/route — the response body must contain visible text and primary entities, not a JS bootstrap stub.
  • Compare prerendered DOM vs runtime DOM via headless Chrome to confirm semantic parity (avoid cloaking risk).
  • Search Console URL Inspection — "Rendered HTML" must match what prerender returns, including structured data.
  • Server logs — Googlebot, GPTBot, OAI-SearchBot must show 200 responses from the prerender path, not from the JS bundle.

References

Last updated:

See also

Need this concept applied to your stack?

Glossary entries are intentionally short. Real engineering tradeoffs need a scoping call — bring the domain, the stack, and the question.