AI search bots do not execute JavaScript like Chrome does during real-time retrieval. Learn how to architect your Next.js App Router components, streaming SSR, and metadata APIs so ChatGPT, Perplexity, and Claude ingest pure server-rendered truth.
'use client' at Route Roots (The JS Wall)
Placing 'use client' at the top of your page file turns the entire subtree into Client-Side Rendering (CSR). When an AI search engine fetches your URL with a raw HTTP GET request, it receives an empty <div id="__next"> shell. AI crawlers do not wait for React hydration bundles.
app/robots.ts Configuration
Next.js has first-class support for programmatic robots.ts generation. Make sure you don't use a catch-all block that accidentally excludes AI user-agents.
// app/robots.ts
import { MetadataRoute } from 'next';/llms.txt via Route HandlerServe a real-time, clean markdown index of your documentation or product catalog using a Next.js App Router Route Handler:
// app/llms.txt/route.ts
export async function GET() {Unlike human browsers running Chromium, AI crawlers (like GPTBot, ClaudeBot, and PerplexityBot) perform lightweight HTTP requests without waiting for client-side JavaScript execution. When a Next.js route has 'use client' at its root, the initial HTML shell contains only an empty container, completely concealing your text and data from AI indexing models.
In Next.js App Router, create an app/robots.ts file using MetadataRoute.Robots. Explicitly define an allow rule for AI agents: ['GPTBot', 'OAI-SearchBot', 'PerplexityBot', 'ClaudeBot'].
Create a route handler at app/llms.txt/route.ts that exports an async function GET() returning plain text markdown with Content-Type: text/plain; charset=utf-8.
Verify live server rendering byte ratios, crawlability across 12 AI bots, and test whether LLMs cite your tech stack accurately.
Order Next.js AEO Diagnosis ($49) →