Nuxt

Nuxt + AI Readiness

Nuxt's universal rendering is great for AI, but missing llms.txt and structured data leave your app invisible. Here's how to fix it.

Why Nuxt Apps Need AI Optimization

Nuxt 3 with Nitro provides excellent SSR by default, but most apps still lack the files and metadata AI agents need to discover and understand your content.

No llms.txt

AI models can't get a structured overview of your site without llms.txt — Nuxt doesn't generate it by default.

Missing nuxt-llms module

The nuxt-llms module auto-generates llms.txt from your content, but most apps don't have it installed.

SPA mode pages

Pages using routeRules with SPA mode or ssr: false are invisible to AI crawlers.

No agent discovery files

agent-card.json and .well-known/ endpoints aren't set up, limiting AI agent integration.

What w2agent Generates

After auditing your Nuxt app, w2agent generates Nitro-native files:

server/routes/llms.txt.ts

Nitro cached event handler with 1hr SWR cache — reads from public/ or generates fallback.

server/middleware/content-negotiation.ts

Redirects AI bots requesting text/markdown at root to /llms.txt.

public/llms.txt

Static fallback served directly by Nitro — works on any hosting.

server/routes/.well-known/agent-card.json.ts

Cached JSON handler for AI agent discovery.

Example: Nitro cached handler for llms.txt

// server/routes/llms.txt.ts
import { defineCachedEventHandler } from "#imports";

export default defineCachedEventHandler(
  async () => {
    const fs = await import("node:fs");
    const path = await import("node:path");
    const filePath = path.join(process.cwd(), "public", "llms.txt");
    if (fs.existsSync(filePath)) {
      return fs.readFileSync(filePath, "utf-8");
    }
    return "# My Site\n\n> AI-ready content\n";
  },
  { swr: true, maxAge: 3600 },
);

Nuxt-Specific Checks

CheckWhat It Tests
SEO module detectionChecks if @nuxtjs/seo is installed for automatic sitemap, robots.txt, and meta tag generation.
LLMs module detectionDetects nuxt-llms for automatic llms.txt generation from your Nuxt content.
Schema.org coverageValidates JSON-LD structured data across pages, including @nuxtjs/schema-org usage.
SSR rendering verificationEnsures pages are server-rendered, not SPA-only — AI crawlers need pre-rendered HTML.

Step-by-Step Integration

1

Install the npm module

npm install @w2agent/nuxt
2

Add to nuxt.config.ts

Add '@w2agent/nuxt' to modules and set w2agent: { siteUrl: 'https://your-site.com' }. The module auto-registers Nitro routes for llms.txt, agent-card, and content negotiation.

3

Deploy

Deploy to any Nitro-compatible host. Content regenerates at build time via postbuild hook.

4

Alternative: run the CLI instead

npx w2agent integrate https://your-nuxt-app.com --install

Score your Nuxt site now

Get your free w2agent score and generate the files your site needs.

Get Your Score

Run from your terminal

npx w2agent audit https://example.com
npx w2agent generate https://example.com
npx w2agent integrate https://example.com
npx w2agent agentize https://example.com
Nuxt AI Readiness | w2agent