Next.js + AI visibility (AIO)
llms.txt and AI crawler rules: allow AI search, opt out of training. This page shows exactly what pickstack adds to a Next.js project for AI visibility (AIO): the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework next --modules aio --yesCustomize in the configurator
New files
import { siteUrl } from "@/lib/site";
export const dynamic = "force-static";
export function GET() {
const body = `# my-app
> my-app: a web app.
## Pages
- [Home](${siteUrl}/)
- [About](${siteUrl}/about)
## Optional
- [Sitemap](${siteUrl}/sitemap.xml)
`;
return new Response(body, {
headers: { "Content-Type": "text/plain; charset=utf-8" },
});
}
import type { MetadataRoute } from "next";
import { siteUrl } from "@/lib/site";
export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: "*",
allow: "/",
other: { "Content-Signal": "search=yes, ai-input=yes, ai-train=no" },
},
{
userAgent: [
"GPTBot",
"ClaudeBot",
"Google-Extended",
"Applebot-Extended",
"meta-externalagent",
"CCBot",
"Bytespider",
],
disallow: "/",
},
],
sitemap: `${siteUrl}/sitemap.xml`,
};
}
import type { MetadataRoute } from "next";
import { siteUrl } from "@/lib/site";
export default function sitemap(): MetadataRoute.Sitemap {
return [{ url: `${siteUrl}/` }, { url: `${siteUrl}/about` }];
}
export const siteUrl =
process.env.NEXT_PUBLIC_SITE_URL ?? "https://example.com";
export const siteName = "my-app";
export const siteDescription = "my-app: a web app.";
Changes to existing files
+import type { Metadata } from "next";+ +export const metadata: Metadata = {+ title: "About",+ alternates: { canonical: "/about" },+ openGraph: { url: "/about" },+};+ export default function About() { return ( <section className="page"> <h1 className="title">About</h1> <p className="text">+ Built with Next.js (App Router), React 19, TypeScript, SEO, llms.txt.− Built with Next.js (App Router), React 19, TypeScript. </p> </section> );⋯ 2 unchanged lines
import type { Metadata } from "next"; import Link from "next/link";+import { siteDescription, siteName, siteUrl } from "@/lib/site"; import "./globals.css"; export const metadata: Metadata = {+ metadataBase: new URL(siteUrl),+ title: { default: siteName, template: `%s | ${siteName}` },+ description: siteDescription,+ alternates: { canonical: "/" },+ openGraph: { type: "website", siteName },+ twitter: { card: "summary" },+};+ +const jsonLd = {+ "@context": "https://schema.org",+ "@type": "WebSite",+ name: siteName,+ url: siteUrl,− title: "my-app",− description: "Generated by pickstack", }; export default function RootLayout({ children }: LayoutProps<"/">) { return ( <html lang="en"> <body>+ <script+ type="application/ld+json"+ dangerouslySetInnerHTML={{+ __html: JSON.stringify(jsonLd).replace(/</g, "\u003c"),+ }}+ /> <main className="app"> <nav className="nav"> <Link className="link" href="/">⋯ 13 unchanged lines
Project files
.gitignoreREADME.mdapp/about/page.tsxapp/globals.cssapp/layout.tsxapp/llms.txt/route.tsapp/page.tsxapp/robots.tsapp/sitemap.tscomponents/Counter.tsxlib/site.tsnext.config.tspackage.jsontsconfig.json