Skip to content

Angular

  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/angular').then(m => m.postBuild({ title: 'My App', url: 'https://myapp.com' }))\""
    }
    }
  3. Build your app:

    Terminal window
    npm run build

The Angular plugin:

  • Reads angular.json to auto-detect the output directory (dist/<project>/browser/)
  • Scans route config files (*.routes.ts) and component directories for routes
  • Scans pre-rendered HTML from the build output for full page content
  • Injects the widget into index.html automatically

You can also generate AEO files from source routes without building:

import { generate } from 'aeo.js/angular';
await generate({ title: 'My App', url: 'https://myapp.com' });

Pass any AeoConfig options to postBuild or generate:

import { postBuild } from 'aeo.js/angular';
await postBuild({
title: 'My App',
url: 'https://myapp.com',
generators: {
robotsTxt: true,
llmsTxt: true,
schema: true,
},
});