Next.js
Install the plugin:
npm install @aeorank/nextConfiguration
Section titled “Configuration”Create an AEO config file:
import type { AeorankNextConfig } from "@aeorank/next";
export const aeoConfig: AeorankNextConfig = { siteName: "My Site", siteUrl: "https://example.com", description: "A description of your site for AI crawlers.", organization: { name: "My Company", url: "https://example.com", }, faq: [ { question: "What does your product do?", answer: "It helps you..." }, ],};Option A: Static Generation
Section titled “Option A: Static Generation”Generate files into public/ at build time:
import { generateAeoFiles } from "@aeorank/next";import { aeoConfig } from "../aeo.config";
generateAeoFiles(aeoConfig);console.log("AEO files generated.");Add to your build script:
{ "scripts": { "build": "tsx scripts/generate-aeo.ts && next build" }}Option B: Dynamic Routes (App Router)
Section titled “Option B: Dynamic Routes (App Router)”Serve files on-demand using route handlers:
import { serveAeoFile } from "@aeorank/next";import { aeoConfig } from "../../aeo.config";
export const GET = serveAeoFile("llms.txt", aeoConfig);Repeat for each file:
app/llms-full.txt/route.tsapp/CLAUDE.md/route.tsapp/schema.json/route.tsapp/robots-patch.txt/route.tsapp/faq-blocks.html/route.tsapp/citation-anchors.html/route.tsapp/sitemap-ai.xml/route.ts
Content-Type Headers
Section titled “Content-Type Headers”Use withAeorank in your Next.js config to set correct headers:
import { withAeorank } from "@aeorank/next";import { aeoConfig } from "./aeo.config";
const aeorank = withAeorank(aeoConfig);
export default aeorank({ // your Next.js config});Generated Files
Section titled “Generated Files”All 8 AEO files are served at your site root: /llms.txt, /llms-full.txt, /CLAUDE.md, /schema.json, /robots-patch.txt, /faq-blocks.html, /citation-anchors.html, /sitemap-ai.xml.