Lovable SEO Fix: Free React SPA Prerendering
Lovable sites are invisible to crawlers. Our free Puppeteer prerender script fixes that — 45+ pages, 19+ meta tags per page, SHA-256 cache that cuts rebuilds from 90 to 0.5 seconds.

Prerendering for your React SPA is the fix that changes everything. In episode 1 we showed that AI-built websites are invisible to crawlers. In episode 3 we reduced the JavaScript bundle by 93%. But even with a small bundle, the core problem remains: crawlers that do not execute JavaScript see an empty page.
Prerendering fixes that. For free. No paid services, no migration to another platform.
The core problem: crawlers cannot run JavaScript
Google can execute JavaScript — slowly, with delays, and not always. But Google is the exception. Most crawlers cannot:
| Platform | Executes JavaScript? | What they see without prerendering | |
|---|---|---|---|
| Yes, with delay | Your page, but days/weeks later | ||
| No | Empty preview, no card | ||
| No | Gray box or bare URL | ||
| Twitter/X | No | No social card | |
| No | No preview | ||
| Slack | No | No unfurl | |
| ChatGPT (GPTBot) | No | Page does not exist for AI | |
| Perplexity | No | Page does not exist for AI | |
| Claude (ClaudeBot) | No | Page does not exist for AI | |
| Bing | Limited | Unreliable |
These are not just search engines. These are the platforms where your customers share your link. Every time someone shares your website on LinkedIn or WhatsApp, they share an empty box. Every time someone asks an AI search engine about your services, you do not exist.
The paid alternatives — and why we skipped them
Services exist that solve this problem:
| Service | Approach | Cost | Drawback | |
|---|---|---|---|---|
| Prerender.io | Cloud-based prerendering | From $20/month | Dependency, limited free tier | |
| LovableHTML | Lovable-specific conversion | Varies | Lovable-specific | |
| Hado SEO | SEO optimization service | Quote-based | External party | |
| NextLovable | Migration to Next.js | $450+ | Complete migration, different framework |
They all solve the same problem: making your website visible to crawlers that cannot execute JavaScript. We achieved the same result with our own script. Cost: $0. Time: one day to build, automatic after that.
How prerendering works — in plain language
Imagine you have a restaurant with a beautiful interior. But the front door is frosted glass. Passersby cannot look inside and walk past.
Prerendering is like putting a photo of your interior on the window. Passersby (crawlers) immediately see what is inside. Guests who enter (real visitors) still get the full experience.
Technically, it works like this:
1. Vite builds the website — as normal, a React SPA with JavaScript
2. A script opens a browser — Puppeteer, a programmatic Chrome browser
3. The browser visits every page — exactly like a real user
4. The script takes a "photo" — the complete HTML after React has rendered
5. That photo is saved — as a static HTML file, with all content, meta tags, and structured data baked in
6. Crawlers get the photo — complete page with all SEO signals, no JavaScript needed
The result: every crawler — Google, LinkedIn, ChatGPT — gets a complete HTML page. No more empty `<div id="root">`.
What our script does — the details
Our prerender script is 890 lines of code. That sounds like a lot, but most of it is defining routes and injecting meta tags. Here is what it does:
45 static pages + dynamic stories
The script knows about 45 fixed routes: the homepage, services, specialist pages, tools, contact page, legal pages. Additionally, it automatically fetches all published stories from Supabase. Currently that is 10+, and growing.
Every page gets its own `index.html` with the fully rendered content.
19+ meta tags per page
For every page, the script injects:
- `<title>` with page title + " | Datakoppelaars"
- `<meta name="description">` — maximum 200 characters
- `<link rel="canonical">` — prevents duplicate content
- Open Graph tags — `og:title`, `og:description`, `og:url`, `og:image`, `og:type`, `og:locale`
- Twitter Card tags — `twitter:title`, `twitter:description`, `twitter:image`
- Hreflang tags — for 9 bilingual page pairs (Dutch ↔ English)
- Structured data — JSON-LD schemas generated by React components are captured and included
- `<html lang="nl|en">` — correct per language
Stories get extra tags: `article:published_time`, `article:author`, and `og:type="article"`.
The browser warm-up trick
A clever detail: before the script renders all pages, it first visits the homepage. Why? The first time Puppeteer loads your React app, Chrome has to parse and compile the full JavaScript bundle. That takes a few seconds. By loading the homepage first — and waiting until React is fully mounted — the V8 JavaScript engine is "warm." All subsequent pages load much faster.
```javascript
// Load homepage to trigger V8 JIT compilation
await page.goto(baseUrl, { waitUntil: 'networkidle2', timeout: 60000 });
await page.waitForFunction(
() => (document.querySelector('#root')?.innerHTML.length ?? 0) > 500,
{ timeout: 60000 }
);
```
The script does not just wait for the page to load — it also checks that React has actually rendered content. At least 500 characters in the root element.
Request interception for speed
Puppeteer intercepts every request the browser makes. Requests to your own website and Supabase go through. Everything else — analytics, external CDNs, tracking scripts — gets blocked. This makes rendering faster and prevents prerendering from depending on external services.
The caching trick: from 90 seconds to 0.5 seconds
This might be the smartest optimization. Starting Puppeteer, rendering 45+ pages — that takes 60-90 seconds. When you build and deploy multiple times per day, that adds up.
Our solution: a content-hash cache.
How it works:
1. At every build, the script computes a SHA-256 hash of three things:
- All JavaScript/CSS files in the build
- The prerender script itself (with all route definitions)
- The Supabase data of published stories
2. If that hash matches the previous build → cache hit: copy the previously rendered pages back. Done in ~0.5 seconds.
3. If the hash differs → cache miss: start Puppeteer, render everything again.
In practice, the JavaScript bundle only changes when we deploy new code. Publishing new stories does trigger a re-render (the Supabase data is different), but that is exactly what you want.
The result: we deploy multiple times per day. Most builds skip Puppeteer entirely.
Docker integration
The cache also works in Docker. Via a BuildKit cache mount, the prerender cache is preserved between Docker builds:
```dockerfile
RUN --mount=type=cache,target=/app/.prerender-cache \
npm run build
```
This means that even when the Docker container is rebuilt, the cache is available. No wasted work.
What changes: before and after
Before prerendering — what a crawler saw:
```html
<html>
<body>
<div id="root"></div>
<script src="/assets/index-abc123.js"></script>
</body>
</html>
```
After prerendering — what that same crawler now sees:
```html
<html lang="nl">
<head>
<title>Systeemintegraties | Datakoppelaars</title>
<meta name="description" content="Nederlands marktleider in systeemintegraties..." />
<link rel="canonical" href="https://datakoppelaars.nl/systeemintegraties" />
<meta property="og:title" content="Systeemintegraties" />
<meta property="og:image" content="/media/socialpreviewimagedk.jpeg" />
<link rel="alternate" hreflang="nl" href="https://datakoppelaars.nl/systeemintegraties" />
<link rel="alternate" hreflang="en" href="https://datakoppelaars.nl/en/system-integrations" />
<script type="application/ld+json">{"@type":"Service",...}</script>
</head>
<body>
<div id="root">
<!-- Fully rendered HTML with all content -->
</div>
</body>
</html>
```

Prerender pipeline: Build, Puppeteer, Snapshot, Cache, Deploy
Every crawler — Google, LinkedIn, ChatGPT — now gets a complete page. With title, description, images, structured data, and the full text. Without executing a single byte of JavaScript.
DIY vs paid: an honest comparison
| Aspect | Our approach (Puppeteer) | Prerender.io | NextLovable migration | |
|---|---|---|---|---|
| Cost | $0 | From $20/month | $450+ one-time | |
| Setup time | 1 day | 1 hour | 1-2 weeks | |
| Maintenance | Self (minimal) | Managed | Self (new framework) | |
| Control | Full | Limited | Full | |
| Cache | Yes (SHA-256) | Cloud-based | N/A (SSR) | |
| Meta tag injection | Fully customizable | Standard | Fully customizable | |
| Hreflang | Yes | Manual | Yes | |
| Structured data | Yes (captures React schemas) | No | Yes | |
| Dynamic content | Yes (Supabase build-time) | Yes (runtime) | Yes (SSR) | |
| Lock-in | None | Yes (service) | Yes (Next.js) |
Our approach costs more initial setup time, but you get full control, no monthly costs, and no dependency on an external service. For a business that deploys multiple times per day, the cache optimization is a huge advantage.
The SPA stays a SPA
A common concern: "If you pre-render HTML, do you lose the SPA experience?"
No. Prerendering does not replace your SPA — it adds a layer on top. Here is what happens:
1. Crawler visits your website → gets the pre-rendered HTML. Sees all content, meta tags, structured data. Done.
2. Real visitor visits your website → gets the same pre-rendered HTML (fast first paint), but the browser also loads the JavaScript. React "hydrates" the page — it takes over the static HTML and makes it an interactive SPA.
Best of both worlds: crawlers get HTML, users get a SPA.
Frequently asked questions
Does prerendering work with dynamic content?
Yes. Our script automatically fetches published stories from Supabase at every build. New content is included as soon as you rebuild. For real-time dynamic content (like a search results page), SSR is a better choice, but for most business websites, build-time prerendering is sufficient.
Do I need SSR (server-side rendering) instead of prerendering?
For most business websites: no. SSR renders pages on the server at every request. That is powerful but more complex and expensive. Prerendering generates HTML once at build time and serves it as static files. Faster, simpler, cheaper. SSR is only needed when your content is different at every request — think personalized dashboards or real-time data.
Can I apply this to my Lovable website?
Yes. Lovable generates React code built by Vite. Our prerender script works with any Vite/React setup. You add the script, adjust your build command, and you are done.
How does this work with my hosting?
Pre-rendered pages are plain HTML files. Any hosting that can serve static files works: Nginx, Apache, Vercel, Netlify, Cloudflare Pages. You do not need a special server.
Does prerendering break when I add new pages?
No. Static pages are added to the route list in the script. Dynamic pages (like stories) are automatically fetched from your database. The cache invalidates itself when routes change — the hash of the script changes with it.
---
This is episode 4 of the 10-part series "The invisible website." Previous episode: code splitting: from 9.9 MB to 671 KB. Next: structured data — from zero to 10+ schema types.
Want prerendering for your AI-built website? Get in touch for a free audit, or explore our system integration services to see how we connect websites and systems.