SvelteKit
-
Install the package:
Terminal window npm install aeo.js -
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' }))\""}} -
Build your app:
Terminal window npm run build
How it works
Section titled “How it works”The SvelteKit plugin:
- Detects the build output:
build/foradapter-static, or.svelte-kit/outputfor other adapters - Scans prerendered HTML pages for titles, descriptions, and full text content
- Scans
src/routesfor+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
Programmatic usage
Section titled “Programmatic usage”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' });Configuration
Section titled “Configuration”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,});