---
name: client-side-rendering-fix
description: Fix sites built with Lovable, Base44, Bolt, Replit, v0 or any React or Vue single-page app where crawlers get an empty HTML shell. Use when raw HTML shows only a root div, or when a user says Google or AI tools cannot see their app's content.
---

# Client-side rendering fix

## Goal
Make every public page return its main text, title, meta description, canonical and links in the first HTML response, without JavaScript.

## Facts to use
- A single-page app often sends `<div id="root"></div>` and builds the page in the browser.
- Google can render JavaScript, but rendering happens in a later step and can fail or be late. Many AI crawlers do not run JavaScript, so they get the empty shell.
- Google says dynamic rendering (a separate HTML version only for bots) was a workaround, not a long-term solution. Google recommends server-side rendering, static rendering or hydration that serves the same HTML to users and bots.

## Options, best first
1. Server-side rendering or static site generation in the framework (for example Next.js, Nuxt, Astro, TanStack Start, Remix). Best when the owner can change the framework.
2. Build-time prerender of public routes into static HTML files (for example a prerender plugin for Vite). Good for marketing pages that do not change per user.
3. Static HTML twins: one plain HTML file per public page with the same text, title, meta and links, served at the same URL by the host or CDN (see static-html-twins).
4. Edge rewrite: a worker or edge function that returns prerendered HTML for public routes.

## Workflow
1. Run the crawler-access-test skill on the main routes. Record raw word count and rendered word count.
2. Identify the platform and host. Lovable, Base44, Bolt and Replit apps often deploy as static SPAs. Check if the platform has a built-in prerender or SSR option first.
3. Pick the highest option the owner can use. Explain the choice in one sentence.
4. Make each public route return in raw HTML: a unique `<title>`, meta description, `<link rel="canonical">`, one `<h1>`, the main body text and `<a href>` links to other pages.
5. Keep app pages that need a login out of scope. Mark them `noindex` if they are reachable.
6. Make unknown routes return status 404 (see soft-404-fix).

## Checks
- [ ] Raw HTML word count is close to rendered word count for each public route.
- [ ] Raw title and canonical match the rendered ones.
- [ ] Google URL Inspection "View crawled page" shows the text.

## Output
The chosen option, the files changed, and a before and after table of raw word counts per route.

## Sources
- Google: Understand JavaScript SEO basics. https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics
- Google: Dynamic rendering as a workaround. https://developers.google.com/search/docs/crawling-indexing/javascript/dynamic-rendering
- Google: Fix Search-related JavaScript problems. https://developers.google.com/search/docs/guides/fix-search-javascript
