TECHNICAL SPECIFICATIONTechnical SEOAI Searchllms.txtReact 19Vite SSRJSON-LD

Why AI Crawlers Ignore Your React Site (And How Prerendering + llms.txt Fix It)

Most React and Vite SPAs serve an empty root div to ChatGPT, Perplexity, and Claude bots. Here is how build-time prerendering and llms.txt fix AI search visibility.

By Saurav • Arivra EngineeringNovember 23, 20261 min read
Why AI Crawlers Ignore Your React Site (And How Prerendering + llms.txt Fix It)

A founder sent us a screenshot last month that is becoming surprisingly common.

They asked ChatGPT and Perplexity: "Who are the best automation agencies for custom CRM integrations?" Three smaller competitors showed up with clean summaries of their pricing, services, and case studies. The founder's own company—despite having a cleaner React website, stronger engineering, and ten detailed service pages—was completely invisible.

When we inspected their site with a plain curl request, the reason jumped off the screen in two seconds.

The server returned a 1.8 KB HTML shell with <div id="root"></div>, a homepage <title>, and a hardcoded <link rel="canonical" href="https://example.com/" /> copied onto every subpage. Every single service description, FAQ, and case study lived locked inside a compiled JavaScript bundle.

Traditional Googlebot eventually runs a headless browser to execute that JavaScript (sometimes days or weeks later). Most AI crawlers—including GPTBot, ClaudeBot, PerplexityBot, and link preview scrapers—do not wait around for a 1.5 MB client bundle to hydrate. If the words are not in the initial HTML response, to them your page is blank.


You Do Not Need to Throw Away Your Vite / React Frontend

When teams hit this wall, the usual knee-jerk advice is "rewrite everything in Next.js or WordPress."

For content-heavy media sites, full SSR frameworks make sense. But if your marketing site or portal already runs cleanly on React and Vite deployed to Cloudflare Pages, rewriting the whole codebase just to satisfy crawlers is wasted engineering time.

You only need three things to make a React site completely legible to both Google and AI answer engines:

  1. Build-time static HTML prerendering for every public route.
  2. True per-route <head> metadata (no static homepage canonical leaking into subpages).
  3. A structured /llms.txt directory and Schema.org JSON-LD graph so models do not have to guess what you sell.
Signal / CrawlerClient-Side SPA OnlyPrerendered HTML + llms.txt
GPTBot / ClaudeBot / PerplexityBotSees empty <div id="root"></div> — skips page or indexes navigation onlyReads full H1, body copy, pricing/FAQ context, and JSON-LD immediately
Googlebot (Two-Wave Rendering)Waits days/weeks in headless render queue; partial index on large sitesIndexes complete semantic HTML on first crawl pass
Canonical & Meta TagsOften inherits homepage canonical before JS hydratesDedicated per-route <title>, description, and self-referencing canonical
AI Citation ReadinessGuesses company services from third-party mentionsConsumes /llms.txt directory + Schema.org Service & FAQPage graphs

What Actually Goes Wrong in Default React Builds

Even teams that care about SEO often leave three subtle bugs in production:

1. The Copy-Pasted Canonical Trap

In a standard Vite app, index.html often includes <link rel="canonical" href="https://yourdomain.com/" /> at the top. Developers assume React will swap it later inside useEffect.

The problem is that non-JS bots only parse the raw HTML file. Every route—/services/ai-solutions, /pricing, /blog/my-post—tells the crawler "ignore this page, the real version is the homepage." Removing the static canonical from your shell template and injecting a self-referencing canonical per route fixes this overnight.

2. Schema Injected Only Inside useEffect

Putting <script type="application/ld+json"> inside a React useEffect hook means it only exists after JavaScript boots in a real browser. Static HTML parsers never see your Service, FAQPage, or TechArticle schema.

Collecting head tags synchronously during a build-time renderToString pass ensures every <title>, <meta>, <link rel="canonical">, and JSON-LD block ships inside the static <head>.

3. Brittle Puppeteer Steps in CI

Some teams try to prerender by launching headless Chrome (puppeteer) inside their build script. It works on a MacBook, then randomly times out or runs out of memory on Cloudflare Pages or Vercel CI runners.

Using Vite's built-in SSR bundle (vite build --ssr) with React's renderToString and StaticRouter runs in plain Node.js in under two seconds—zero browser binaries required.

1. Static Build Pass

Compile Vite client bundle + lightweight Node SSR entry with zero headless Chrome overhead on CI.

2. Per-Route Head & HTML

Render each route into its own index.html with unique canonical, H1, and JSON-LD.

3. AI Discovery Layer

Serve /llms.txt and /sitemap.xml so bots map your core services fast.


How the Zero-Browser Prerender Pipeline Works

At Arivra, we keep this setup intentionally boring and fast. After vite build creates the client dist/ folder, a tiny post-build script compiles an SSR entry (entry-server.jsx), loops through all static routes plus non-draft MDX slugs, and writes each route's rendered HTML directly into dist/<route>/index.html:

// Simplified post-build loop (runs in Node.js after vite build)
for (const route of allPublicRoutes) {
  const { html, helmet } = render(route);

  const pageHtml = templateHtml
    .replace(/<title>[\s\S]*?<\/title>\s*/i, "")
    .replace(/<meta\s+name="description"[^>]*>\s*/i, "")
    .replace("<!--app-head-->", [helmet.title, helmet.meta, helmet.link, helmet.script].join("\n"))
    .replace('<div id="root"></div>', `<div id="root">${html}</div>`);

  writeRouteHtml(route, pageHtml);
}

On the client side, main.jsx checks whether #root already contains prerendered DOM children. If it does, it calls hydrateRoot instead of createRoot—preserving smooth interactivity without flashing the screen.

And right beside sitemap.xml, the build script generates /llms.txt: a clean, plain-Markdown summary of your core services, outcome pages, and published technical guides so AI agents can verify facts accurately in one HTTP request.


Quick Verification Checklist You Can Run Today

Before assuming your site is visible to AI search, run two quick checks against your live domain or dist/ folder:

  1. Fetch raw HTML without JavaScript: Run curl -s https://yourdomain.com/services/your-service | grep -i "<h1". If nothing comes back, AI crawlers are seeing an empty shell.
  2. Check canonical tags on subpages: Make sure curl -s https://yourdomain.com/about | grep canonical points to /about, not /.
  3. Keep draft content out of feeds: Ensure any draft: true MDX posts are excluded from sitemap.xml, rss.xml, llms.txt, and prerender routes.

If you want to see how we structure technical SEO, prerendering, and schema pipelines for client platforms, inspect our Performance & SEO engineering blueprint or book a quick architecture review.