Next.js llms.txt Generator Guide (App Router & Static Export) for AI Search Citations
An /llms.txt file gives AI search assistants a curated, noise-free Markdown map of your product, docs, pricing, and API endpoints without forcing crawlers to parse megabytes of client-side JS bundles.
1. Minimal Static /llms.txt (public/llms.txt)
For marketing sites or static exports, place a UTF-8 Markdown file at public/llms.txt. Follow the official llmstxt.org format: H1 brand name, blockquote one-sentence summary, then H2 sections with Markdown links and concise descriptions.
# Acme Analytics
> Privacy-first product analytics and session replay for SaaS engineering teams.
## Core Docs
- [Quickstart Guide](https://acme.example/docs/quickstart): Install the 4 KB script in 2 minutes
- [Pricing](https://acme.example/pricing): Free up to 100k events/mo; Pro starts at $29/mo
- [REST API Reference](https://acme.example/docs/api): Event ingestion & cohort export endpoints
2. Dynamic Next.js App Router Route (app/llms.txt/route.ts)
If your docs or changelog update frequently, serve /llms.txt from a Next.js Route Handler with Content-Type: text/plain; charset=utf-8 and proper cache headers:
// app/llms.txt/route.ts
import { NextResponse } from "next/server";
export const revalidate = 3600;
export async function GET() {
const md = [
"# Acme Analytics",
"",
"> Privacy-first product analytics for SaaS teams.",
"",
"## Key Pages",
"- [Docs](https://acme.example/docs): SDK setup & SQL query guide",
"- [Pricing](https://acme.example/pricing): Transparent self-serve tiers",
].join("\n");
return new NextResponse(md, {
headers: { "Content-Type": "text/plain; charset=utf-8" },
});
}
3. Generate a Live Starter /llms.txt & Check AI Crawlers
Skip manual scaffolding with our Free Live llms.txt Generator (parses your homepage + sitemap.xml in ~1 second to build an llmstxt.org starter and count unindexed subpages). Also verify your robots.txt does not disallow OAI-SearchBot, PerplexityBot, or ClaudeBot, and unlock full 5-platform deployment guides, Schema.org Entity Graph code, and 50-URL batch audits directly in-browser with CiteReady Web Pro ($12 one-time).
# Verify your Next.js site's AI readiness from your terminal:
npx github:zColdWater/citeready-cli audit https://yourdomain.com
Run a Live 3-Engine Launch Audit on Your Domain (Free, Zero Signup)
Enter your domain once to audit Security Headers & JS Secrets + Email DNS (SPF/DKIM/DMARC) + AI Search (/llms.txt) concurrently inline, or jump directly to any single flagship tool:
Frequently Asked Questions
Does Next.js App Router support a route folder literally named llms.txt?
Yes. Creating app/llms.txt/route.ts serves GET /llms.txt with full control over Content-Type and ISR caching.
Should /llms.txt return text/plain or text/markdown?
text/plain; charset=utf-8 or text/markdown; charset=utf-8 are both accepted by AI crawlers; never return text/html.
CiteReady v6.0 Web Pro ($2 Launch Special, was $12 one-time, zero install) unlocks unmasked 5-platform fix wizards (Next.js, WordPress, Webflow/Shopify, Cloudflare, Cursor/Lovable), full Schema.org Entity Graph & /llms.txt code, 50-URL browser batch CSV export, and printable A4 PDF reports. 14-day refund guarantee.