Skip to content

SvelteKit

  1. Install the package:

    Terminal window
    npm install aeo.js
  2. Add a post-build step to your package.json:

    {
    "scripts": {
    "postbuild": "node -e \"import('aeo.js/sveltekit').then(m => m.postBuild({ title: 'My Site', url: 'https://mysite.com' }))\""
    }
    }
  3. Build your app:

    Terminal window
    npm run build

The SvelteKit plugin:

  • Detects the build output: build/ for adapter-static, or .svelte-kit/output for other adapters
  • Scans prerendered HTML pages for titles, descriptions, and full text content
  • Scans src/routes for +page.svelte (and mdsvex +page.md/+page.svx) routes — route groups like (marketing) are transparent, dynamic segments like [slug] are skipped
  • Generates all AEO files (robots.txt, llms.txt, sitemap.xml, ai-index.json, …) into the output directory
  • Injects the Human/AI widget into every prerendered page

Generate AEO files from source routes without a build — files land in static/ so any adapter ships them:

import { generate } from 'aeo.js/sveltekit';
await generate({ title: 'My Site', url: 'https://mysite.com' });

Pass any AeoConfig options to postBuild or generate:

import { postBuild } from 'aeo.js/sveltekit';
await postBuild({
title: 'My Site',
url: 'https://mysite.com',
description: 'A site optimized for AI discovery',
widget: { enabled: true, position: 'bottom-right' },
// Skip widget injection into prerendered HTML:
// injectWidget: false,
});