Skip to content
npm downloadsGitHub stars

VitePress

  1. Install the package:

    Terminal window
    npm install aeo.js
  2. Wrap your config in .vitepress/config.ts:

    import { defineConfig } from 'vitepress';
    import { withAeo } from 'aeo.js/vitepress';
    export default defineConfig(
    withAeo(
    {
    title: 'My Docs',
    description: 'My documentation site',
    // …the rest of your VitePress config…
    },
    { url: 'https://mysite.com' }
    )
    );
  3. Build your site:

    Terminal window
    npm run docs:build

withAeo(config, options) wraps your VitePress config and composes two build hooks:

  • transformHtml — runs per page during the build. It collects each page’s URL, title, description, and rendered text content, and injects the AEO widget before </body>.
  • buildEnd — after the build, generates all AEO files (robots.txt, llms.txt, sitemap.xml, ai-index.json, …) into the VitePress output directory.

url, title, and description default from your VitePress site config (and sitemap.hostname) when omitted.

Pass any AeoConfig options as the second argument. Add pages VitePress doesn’t emit via pages — your entries always win:

withAeo(config, {
url: 'https://mysite.com',
title: 'My Docs',
schema: { organization: { name: 'My Company' } },
});