llms.txt Generator for Next.js Apps
Audit your Next.js site's SSR HTML, JSON-LD, and robots.ts rules—then deploy /llms.txt statically in /public or dynamically via an App Router Route Handler.
Next.js makes serving /llms.txt trivial: drop a static file into public/llms.txt for instant CDN caching, or create app/llms.txt/route.ts to generate it dynamically from your CMS or database.
Step-by-Step Next.js Setup
- 01
Scan your deployed Next.js production URL above to inspect server-rendered metadata, JSON-LD types, and app/robots.ts rules.
- 02
Copy or download the generated Markdown file from the Generated llms.txt tab.
- 03
Save it to public/llms.txt in your repository—or use app/llms.txt/route.ts if your routes update dynamically from a headless CMS.
- 04
Ensure app/robots.ts explicitly allows OAI-SearchBot, PerplexityBot, and ClaudeBot, then deploy and verify https://yourdomain.com/llms.txt.
import { NextResponse } from "next/server";
export const revalidate = 3600; // Revalidate hourly
export async function GET() {
const body = [
"# Your Product Name",
"",
"> Concise summary of your SaaS or platform for AI search assistants.",
"",
"## Core Pages",
"- [Homepage](https://yourdomain.com/)",
"- [Pricing](https://yourdomain.com/pricing)",
"- [Documentation](https://yourdomain.com/docs)",
].join("\n");
return new NextResponse(body, {
status: 200,
headers: {
"Content-Type": "text/plain; charset=utf-8",
"Cache-Control": "public, max-age=3600, s-maxage=3600",
},
});
}Recommended Next.js llms.txt Blueprint
SSR landing pages, pricing, security/compliance overview, and company facts.
Quickstart, API reference, SDK guides, and integration pages.
Feature breakdowns, use-case pages, and competitor comparison routes.
Changelog, legal terms, and privacy policy.
Common Next.js AI Search Pitfalls
Rendering core marketing copy purely inside client-side useEffect hooks where non-JS AI crawlers only see loading skeletons.
Forgetting to exclude /llms.txt from Next.js i18n or auth middleware matchers, causing a 307 redirect to /en/llms.txt or /login.
Missing <main> landmarks or JSON-LD SoftwareApplication markup in root layouts.
Next.js llms.txt FAQs
Should I put llms.txt in public/ or use a Next.js Route Handler?
Use public/llms.txt if your key pages change weekly or monthly—it is served directly from the edge CDN with zero serverless invocations. Use app/llms.txt/route.ts with ISR (revalidate) if you publish frequent docs or programmatic SEO pages from a CMS.
Why does Next.js middleware sometimes break /llms.txt?
Locale-prefixing or auth middleware often intercepts unknown paths and redirects /llms.txt to /en/llms.txt. Exclude llms.txt in your middleware config matcher regex: '/((?!api|_next|llms\\.txt|robots\\.txt|sitemap\\.xml).*)'
Can AI crawlers read Next.js client components?
Many AI crawlers (including PerplexityBot and ClaudeBot) do not execute heavy client-side JavaScript. Keep key headings, pricing details, FAQs, and JSON-LD inside React Server Components.
Related Platform & GEO Guides
View all 24 guides →Free On-Demand Scanner. Automate When You Scale.
Generate and download /llms.txt free forever with zero login. Upgrade only when you want automated weekly syncs, crawler-block alerts, or agency client reports.
Everything you need to audit any public site and ship a clean /llms.txt today.
- Unlimited zero-login live domain scans
- 0–100 AI Search Visibility Score & breakdown
- 8-bot robots.txt AI crawler inspection
- Spec-compliant /llms.txt generator (Copy & Download)
- JSON-LD, canonical & semantic HTML audit
For SaaS teams, Shopify merchants, and publishers keeping AI search visibility continuously protected.
- Up to 3 monitored production domains
- Weekly auto-regenerated /llms.txt diffs & hosted URL
- Instant email/Slack alerts if any AI search bot gets blocked
- Sitemap & JSON-LD regression tracking
- Historical 0–100 GEO score trendline
Built for SEO agencies and web studios delivering client-ready GEO audits at scale.
- 25 client websites with weekly auto-monitoring
- White-label GEO Audit PDF exports for client pitches
- Multi-client AI crawler block alert digest
- Bulk /llms.txt regeneration across Shopify, WP & Webflow
- Priority onboarding & custom webhook notifications