Nuxt + 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 Nuxt 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 nuxt --modules aio --yesCustomize in the configurator
New files
export default defineEventHandler((event) => {
const { siteUrl } = useRuntimeConfig(event).public;
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
return `# my-app
> my-app: a web app.
## Pages
- [Home](${siteUrl}/)
- [About](${siteUrl}/about)
## Optional
- [Sitemap](${siteUrl}/sitemap.xml)
`;
});
export default defineEventHandler((event) => {
const { siteUrl } = useRuntimeConfig(event).public;
setHeader(event, "Content-Type", "text/plain; charset=utf-8");
return `User-agent: *
Content-Signal: search=yes, ai-input=yes, ai-train=no
Allow: /
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: Applebot-Extended
User-agent: meta-externalagent
User-agent: CCBot
User-agent: Bytespider
Disallow: /
Sitemap: ${siteUrl}/sitemap.xml
`;
});
export default defineEventHandler((event) => {
const { siteUrl } = useRuntimeConfig(event).public;
setHeader(event, "Content-Type", "application/xml; charset=utf-8");
return `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>${siteUrl}/</loc>
</url>
<url>
<loc>${siteUrl}/about</loc>
</url>
</urlset>
`;
});
Changes to existing files
+<script setup lang="ts">+const { siteUrl } = useRuntimeConfig().public;+const route = useRoute();+ +useHead({+ link: [{ rel: "canonical", href: () => `${siteUrl}${route.path}` }],+ script: [+ {+ type: "application/ld+json",+ innerHTML: JSON.stringify({+ "@context": "https://schema.org",+ "@type": "WebSite",+ name: "my-app",+ url: siteUrl,+ }),+ },+ ],+});+ +useSeoMeta({+ description: "my-app: a web app.",+ ogType: "website",+ ogSiteName: "my-app",+ ogUrl: () => `${siteUrl}${route.path}`,+ twitterCard: "summary",+});+</script>+ <template> <NuxtRouteAnnouncer /> <main class="app">⋯ 8 unchanged lines
+<script setup lang="ts">+useSeoMeta({ title: "About" });+</script>+ <template> <section class="page"> <h1 class="title">About</h1>+ <p class="text">Built with Nuxt 4, Vue 3, TypeScript, SEO, llms.txt.</p>− <p class="text">Built with Nuxt 4, Vue 3, TypeScript.</p> </section> </template>
+<script setup lang="ts">+useSeoMeta({ title: "Home" });+</script>+ <template> <section class="page"> <h1 class="title">my-app</h1>⋯ 4 unchanged lines
⋯ 2 unchanged lines compatibilityDate: "2025-07-15", devtools: { enabled: true }, css: ["~/assets/css/main.css"],+ app: { head: { htmlAttrs: { lang: "en" }, titleTemplate: "%s | my-app" } },+ runtimeConfig: { public: { siteUrl: "https://example.com" } },+ nitro: {+ prerender: { routes: ["/robots.txt", "/sitemap.xml", "/llms.txt"] },+ }, });
Project files
.gitignoreREADME.mdapp/app.vueapp/assets/css/main.cssapp/components/CounterCard.vueapp/pages/about.vueapp/pages/index.vuenuxt.config.tspackage.jsonpublic/robots.txtserver/routes/llms.txt.tsserver/routes/robots.txt.tsserver/routes/sitemap.xml.tstsconfig.json