seo-ssr-and-prerendering
Skill10 starsChanged 6 months agoMITView on GitHub
Use when a Lovable SPA needs Google or social crawlers to see populated HTML: SSR, prerendering, react-snap, prerender.io, vite-ssg, or migrating routes to static. Not for fully authenticated apps with no public surface.
- Installs packages
In this repository56 other files it gives its agents.
- accessibility-passSkill
- analytics-eventsSkill
- api-error-handlingSkill
- audit-logging-backendSkill
- background-jobs-and-cronSkill
- dark-mode-and-themingSkill
- dashboard-charts-rechartsSkill
- edge-functions-and-webhooksSkill
- email-and-notificationsSkill
- error-states-and-empty-uiSkill
- feature-flags-and-togglesSkill
- file-upload-storageSkill
- i18n-multi-languageSkill
- lovable-prompting-playbookSkill
- lovable-ship-checklistSkill
- migration-playbookSkill
- multi-tenant-backendSkill
- onboarding-copySkill
- optimistic-updatesSkill
- payment-failed-and-recoverySkill
- payment-webhook-idempotencySkill
- payment-webhook-testingSkill
- performance-budgetSkill
- pg-cron-recipesSkill
- pg-cron-scheduled-jobsSkill
- pg-cron-with-pg-net-edgeSkill
- postgres-full-text-searchSkill
- postgres-triggers-and-functionsSkill
- pricing-and-billingSkill
- programmatic-seo-content-qualitySkill
- programmatic-seo-pagesSkill
- rate-limiting-edgeSkill
- realtime-and-subscriptionsSkill
- refactor-safe-diffSkill
- release-notesSkill
- seo-core-web-vitalsSkill
- seo-landing-pageSkill
- seo-meta-tags-spaSkill
- seo-sitemap-generationSkill
- seo-structured-dataSkill
- server-input-validationSkill
- shadcn-patternsSkill
- soft-delete-and-archivingSkill
- stripe-one-time-payment-webhooksSkill
- stripe-payment-webhooksSkill
- supabase-auth-flowsSkill
- supabase-database-designSkill
- supabase-rls-and-authSkill
- support-replySkill
- tanstack-infinite-queriesSkill
- tanstack-mutations-and-invalidationSkill
- tanstack-prefetch-and-hydrationSkill
- tanstack-query-alternativeSkill
- tanstack-router-data-loadersSkill
- tanstack-start-server-routesSkill
- typed-api-hooks-formsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Start with prerendering; move to SSR only when content changes too fast for a rebuild.
- Distinctive: line 54
If you can't change the build pipeline:
- Distinctive: line 56
Add a serverless function or middleware that detects bot User-Agents and proxies to prerender.io.
- Distinctive: line 79
Don't prerender a "loading…" shell.
- Very specific: line 82
Use tanstack-prefetch-and-hydration to embed a dehydrated cache and hydrate on the client without a refetch flash.
- Very specific: line 93
Do not prerender authenticated routes (/app, /dashboard, /settings) — they should redirect to login.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SEO SSR and prerendering
Lovable apps are Vite + React SPAs. Crawlers and link-preview bots see an empty <div id="root"></div> until JS runs. Public marketing pages must ship populated HTML — Google does run JS, but indexing is slower and less reliable than HTML-first; Twitter/LinkedIn/Slack/Discord bots do not run JS at all.
Companion skills: seo-meta-tags-spa, seo-landing-page, tanstack-prefetch-and-hydration, programmatic-seo-pages.
When to use what
| Site type | Recommended approach |
| Marketing site + blog + a few public routes | Build-time prerender (vite-plugin-prerender, react-snap, or vite-ssg) |
| Hundreds/thousands of pages from data (locations, comparisons) | Static generation (vite-ssg with route iterator) |
| Truly dynamic public pages updated minute-to-minute | SSR via a Node server (Cloudflare Pages Functions, Vercel, Render) |
| Hybrid: SPA app + a few public marketing routes | Prerender just the public routes |
Start with prerendering; move to SSR only when content changes too fast for a rebuild.
Build-time prerender (vite-ssg pattern)
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
// vite-ssg config in package.json or its own file
});// src/main.tsx
import { ViteSSG } from "vite-ssg";
import App from "./App";
import { routes } from "./routes";
export const createApp = ViteSSG(App, { routes }, ({ app, router, isClient, initialState }) => {
// hydrate or set up per-app state
});For each public route, expose an includedRoutes generator that lists URLs (e.g. one per blog post slug, one per location).
Prerender service (prerender.io / Browserless)
If you can't change the build pipeline:
- Add a serverless function or middleware that detects bot User-Agents and proxies to prerender.io.
- Prerender.io caches the rendered HTML and serves it to crawlers.
This is fine as a stopgap but slower and not free at scale.
react-snap (alternative, low-effort)
npm i -D react-snap{
"scripts": { "postbuild": "react-snap" }
}Edit index.html to use hydrateRoot instead of createRoot so the prerendered HTML hydrates cleanly.
Caveats: react-snap is unmaintained but still works for static SPAs.
Hydration with data
Don't prerender a "loading…" shell. Either:
- Fetch data at build time and pass it through, or
- Use
tanstack-prefetch-and-hydrationto embed a dehydrated cache and hydrate on the client without a refetch flash.
Routes to prerender — checklist
/(home)/pricing/blogand every/blog/[slug]/about,/contact,/changelog,/legal/*- Programmatic templates (
/integrations/[tool],/locations/[city]) — seeprogrammatic-seo-pages - 404 page (
/404.html)
Do not prerender authenticated routes (/app, /dashboard, /settings) — they should redirect to login.
Verify
For every public URL, raw HTML must include the title, meta, and main content:
curl -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" \
https://your-domain.com/pricing | grep -iE '<title|<h1|og:title'Also check Twitter card / Open Graph rendering: https://cards-dev.twitter.com/validator, https://developers.facebook.com/tools/debug/.
Avoid
- Shipping a Lovable marketing site as a pure SPA and hoping Google figures it out.
- Prerendering authenticated routes and leaking dashboard chrome to crawlers.
- Different HTML for bots vs users (cloaking) — Google penalizes.
- Forgetting
hydrateRootafter introducing prerender — causes a re-render flash.
Checklist
- Every public route ships with title, meta, h1, and primary copy in raw HTML.
- OG image and Twitter card validated in third-party debuggers.
- Auth routes excluded from prerender.
- Sitemap and robots.txt in sync with prerendered URL list (
seo-sitemap-generation).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

