aeo.js 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +303 -6
- package/dist/angular.d.mts +29 -0
- package/dist/angular.d.ts +29 -0
- package/dist/angular.js +1314 -0
- package/dist/angular.js.map +1 -0
- package/dist/angular.mjs +1310 -0
- package/dist/angular.mjs.map +1 -0
- package/dist/astro.d.mts +15 -0
- package/dist/astro.d.ts +15 -0
- package/dist/astro.js +1421 -0
- package/dist/astro.js.map +1 -0
- package/dist/astro.mjs +1414 -0
- package/dist/astro.mjs.map +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1880 -2
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +1878 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +191 -0
- package/dist/index.d.ts +191 -1
- package/dist/index.js +1829 -1
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1801 -1
- package/dist/index.mjs.map +1 -0
- package/dist/next.d.mts +18 -0
- package/dist/next.d.ts +18 -0
- package/dist/next.js +1302 -0
- package/dist/next.js.map +1 -0
- package/dist/next.mjs +1295 -0
- package/dist/next.mjs.map +1 -0
- package/dist/nuxt.d.mts +13 -0
- package/dist/nuxt.d.ts +13 -0
- package/dist/nuxt.js +1344 -0
- package/dist/nuxt.js.map +1 -0
- package/dist/nuxt.mjs +1337 -0
- package/dist/nuxt.mjs.map +1 -0
- package/dist/react.d.mts +10 -0
- package/dist/react.d.ts +10 -0
- package/dist/react.js +1023 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1020 -0
- package/dist/react.mjs.map +1 -0
- package/dist/types-Cn_Qbkmg.d.mts +166 -0
- package/dist/types-Cn_Qbkmg.d.ts +166 -0
- package/dist/vite.d.mts +5 -0
- package/dist/vite.d.ts +5 -0
- package/dist/vite.js +1370 -0
- package/dist/vite.js.map +1 -0
- package/dist/vite.mjs +1366 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/vue.d.mts +19 -0
- package/dist/vue.d.ts +19 -0
- package/dist/vue.js +1078 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +1072 -0
- package/dist/vue.mjs.map +1 -0
- package/dist/webpack.d.mts +11 -0
- package/dist/webpack.d.ts +11 -0
- package/dist/webpack.js +1179 -0
- package/dist/webpack.js.map +1 -0
- package/dist/webpack.mjs +1173 -0
- package/dist/webpack.mjs.map +1 -0
- package/dist/widget.d.mts +37 -0
- package/dist/widget.d.ts +37 -0
- package/dist/widget.js +1004 -0
- package/dist/widget.js.map +1 -0
- package/dist/widget.mjs +1001 -0
- package/dist/widget.mjs.map +1 -0
- package/package.json +110 -10
package/README.md
CHANGED
|
@@ -2,18 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
Answer Engine Optimization for the modern web. Make your site discoverable by AI crawlers and LLMs.
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://ralphstarter.ai/badge"><img src="https://ralphstarter.ai/img/badge-built-with@2x.png" alt="built with ralph-starter" height="28"></a>
|
|
7
|
+
</p>
|
|
6
8
|
|
|
7
9
|
## What is AEO?
|
|
8
10
|
|
|
9
11
|
Answer Engine Optimization (AEO) is the practice of making your website discoverable and citable by AI-powered answer engines like ChatGPT, Claude, Perplexity, and SearchGPT.
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
aeo.js auto-generates the files these engines look for and provides a drop-in widget that shows visitors how your site appears to AI.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **`llms.txt` / `llms-full.txt`** -- LLM-readable summaries of your site
|
|
18
|
+
- **`robots.txt`** -- AI-crawler-aware robots directives
|
|
19
|
+
- **`sitemap.xml`** -- Standard sitemap generation
|
|
20
|
+
- **`docs.json`** -- Structured documentation manifest
|
|
21
|
+
- **`ai-index.json`** -- AI-optimized content index
|
|
22
|
+
- **Raw Markdown** -- Per-page `.md` files extracted from your HTML
|
|
23
|
+
- **Human/AI Widget** -- Drop-in toggle showing the AI-readable version of any page
|
|
24
|
+
- **CLI** -- `npx aeo.js generate` to run standalone
|
|
25
|
+
|
|
26
|
+
## Supported Frameworks
|
|
27
|
+
|
|
28
|
+
| Framework | Status | Import |
|
|
29
|
+
|-----------|--------|--------|
|
|
30
|
+
| Astro | Stable | `aeo.js/astro` |
|
|
31
|
+
| Next.js | Stable | `aeo.js/next` |
|
|
32
|
+
| Vite / React | Stable | `aeo.js/vite` |
|
|
33
|
+
| Nuxt | Stable | `aeo.js/nuxt` |
|
|
34
|
+
| Angular | Stable | `aeo.js/angular` |
|
|
35
|
+
| Webpack | Stable | `aeo.js/webpack` |
|
|
36
|
+
| Any (CLI) | Stable | `npx aeo.js generate` |
|
|
17
37
|
|
|
18
38
|
## Install
|
|
19
39
|
|
|
@@ -21,6 +41,283 @@ Answer Engine Optimization (AEO) is the practice of making your website discover
|
|
|
21
41
|
npm install aeo.js
|
|
22
42
|
```
|
|
23
43
|
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
### Astro
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// astro.config.mjs
|
|
50
|
+
import { defineConfig } from 'astro/config';
|
|
51
|
+
import { aeoAstroIntegration } from 'aeo.js/astro';
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
site: 'https://mysite.com',
|
|
55
|
+
integrations: [
|
|
56
|
+
aeoAstroIntegration({
|
|
57
|
+
title: 'My Site',
|
|
58
|
+
description: 'A site optimized for AI discovery',
|
|
59
|
+
url: 'https://mysite.com',
|
|
60
|
+
}),
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The widget is automatically injected and persists across View Transitions.
|
|
66
|
+
|
|
67
|
+
### Next.js
|
|
68
|
+
|
|
69
|
+
Wrap your Next.js config with `withAeo`:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// next.config.mjs
|
|
73
|
+
import { withAeo } from 'aeo.js/next';
|
|
74
|
+
|
|
75
|
+
export default withAeo({
|
|
76
|
+
aeo: {
|
|
77
|
+
title: 'My Site',
|
|
78
|
+
description: 'A site optimized for AI discovery',
|
|
79
|
+
url: 'https://mysite.com',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
After building, run the post-build step to extract content from pre-rendered pages:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"scripts": {
|
|
89
|
+
"postbuild": "node -e \"import('aeo.js/next').then(m => m.postBuild({ title: 'My Site', url: 'https://mysite.com' }))\""
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Vite (React, Vue, Svelte, etc.)
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
// vite.config.ts
|
|
98
|
+
import { defineConfig } from 'vite';
|
|
99
|
+
import { aeoVitePlugin } from 'aeo.js/vite';
|
|
100
|
+
|
|
101
|
+
export default defineConfig({
|
|
102
|
+
plugins: [
|
|
103
|
+
aeoVitePlugin({
|
|
104
|
+
title: 'My Site',
|
|
105
|
+
description: 'A site optimized for AI discovery',
|
|
106
|
+
url: 'https://mysite.com',
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The Vite plugin:
|
|
113
|
+
- Generates AEO files on `vite dev` and `vite build`
|
|
114
|
+
- Injects the widget automatically
|
|
115
|
+
- Serves dynamic `.md` files in dev (extracts content from your running app)
|
|
116
|
+
- Detects SPA shells and falls back to client-side DOM extraction
|
|
117
|
+
|
|
118
|
+
### Nuxt
|
|
119
|
+
|
|
120
|
+
Add the module to your Nuxt config:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
// nuxt.config.ts
|
|
124
|
+
export default defineNuxtConfig({
|
|
125
|
+
modules: ['aeo.js/nuxt'],
|
|
126
|
+
aeo: {
|
|
127
|
+
title: 'My Site',
|
|
128
|
+
description: 'A site optimized for AI discovery',
|
|
129
|
+
url: 'https://mysite.com',
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The Nuxt module:
|
|
135
|
+
- Scans your `pages/` directory for routes
|
|
136
|
+
- Generates AEO files during dev and production builds
|
|
137
|
+
- Scans pre-rendered HTML from `.output/public/` for full page content
|
|
138
|
+
- Injects the widget as a client-side Nuxt plugin
|
|
139
|
+
- Adds `<link>` and `<meta>` tags for AEO discoverability
|
|
140
|
+
|
|
141
|
+
### Angular
|
|
142
|
+
|
|
143
|
+
Add a post-build step to your `package.json`:
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"scripts": {
|
|
148
|
+
"postbuild": "node -e \"import('aeo.js/angular').then(m => m.postBuild({ title: 'My App', url: 'https://myapp.com' }))\""
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The Angular plugin:
|
|
154
|
+
- Reads `angular.json` to auto-detect the output directory (`dist/<project>/browser/`)
|
|
155
|
+
- Scans route config files (`*.routes.ts`) and component directories for routes
|
|
156
|
+
- Scans pre-rendered HTML from the build output for full page content
|
|
157
|
+
- Injects the widget into `index.html` automatically
|
|
158
|
+
|
|
159
|
+
You can also generate AEO files from source routes without building:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { generate } from 'aeo.js/angular';
|
|
163
|
+
|
|
164
|
+
await generate({ title: 'My App', url: 'https://myapp.com' });
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Webpack
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
// webpack.config.js
|
|
171
|
+
const { AeoWebpackPlugin } = require('aeo.js/webpack');
|
|
172
|
+
|
|
173
|
+
module.exports = {
|
|
174
|
+
plugins: [
|
|
175
|
+
new AeoWebpackPlugin({
|
|
176
|
+
title: 'My Site',
|
|
177
|
+
description: 'A site optimized for AI discovery',
|
|
178
|
+
url: 'https://mysite.com',
|
|
179
|
+
}),
|
|
180
|
+
],
|
|
181
|
+
};
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## CLI
|
|
185
|
+
|
|
186
|
+
Run aeo.js from the command line without any framework integration:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Generate all AEO files
|
|
190
|
+
npx aeo.js generate
|
|
191
|
+
|
|
192
|
+
# Generate with options
|
|
193
|
+
npx aeo.js generate --url https://mysite.com --title "My Site" --out public
|
|
194
|
+
|
|
195
|
+
# Create a config file
|
|
196
|
+
npx aeo.js init
|
|
197
|
+
|
|
198
|
+
# Check your setup
|
|
199
|
+
npx aeo.js check
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Commands
|
|
203
|
+
|
|
204
|
+
| Command | Description |
|
|
205
|
+
|---------|-------------|
|
|
206
|
+
| `generate` | Generate all AEO files (robots.txt, llms.txt, sitemap.xml, etc.) |
|
|
207
|
+
| `init` | Create an `aeo.config.ts` configuration file |
|
|
208
|
+
| `check` | Validate your AEO setup and show what would be generated |
|
|
209
|
+
|
|
210
|
+
### Options
|
|
211
|
+
|
|
212
|
+
| Flag | Description |
|
|
213
|
+
|------|-------------|
|
|
214
|
+
| `--out <dir>` | Output directory (default: auto-detected) |
|
|
215
|
+
| `--url <url>` | Site URL |
|
|
216
|
+
| `--title <title>` | Site title |
|
|
217
|
+
| `--no-widget` | Disable widget generation |
|
|
218
|
+
| `--help`, `-h` | Show help |
|
|
219
|
+
| `--version`, `-v` | Show version |
|
|
220
|
+
|
|
221
|
+
## Configuration
|
|
222
|
+
|
|
223
|
+
All framework plugins accept the same config object. You can also use `defineConfig` for standalone configs:
|
|
224
|
+
|
|
225
|
+
```js
|
|
226
|
+
import { defineConfig } from 'aeo.js';
|
|
227
|
+
|
|
228
|
+
export default defineConfig({
|
|
229
|
+
// Required
|
|
230
|
+
title: 'My Site',
|
|
231
|
+
url: 'https://mysite.com',
|
|
232
|
+
|
|
233
|
+
// Optional
|
|
234
|
+
description: 'A description of your site',
|
|
235
|
+
contentDir: 'docs', // Directory with handwritten .md files
|
|
236
|
+
outDir: 'public', // Output directory for generated files
|
|
237
|
+
|
|
238
|
+
// Toggle individual generators
|
|
239
|
+
generators: {
|
|
240
|
+
robotsTxt: true, // robots.txt
|
|
241
|
+
llmsTxt: true, // llms.txt
|
|
242
|
+
llmsFullTxt: true, // llms-full.txt
|
|
243
|
+
rawMarkdown: true, // Per-page .md files
|
|
244
|
+
manifest: true, // docs.json
|
|
245
|
+
sitemap: true, // sitemap.xml
|
|
246
|
+
aiIndex: true, // ai-index.json
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
// Customize robots.txt
|
|
250
|
+
robots: {
|
|
251
|
+
allow: ['/'],
|
|
252
|
+
disallow: ['/admin'],
|
|
253
|
+
crawlDelay: 0,
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
// Widget configuration
|
|
257
|
+
widget: {
|
|
258
|
+
enabled: true,
|
|
259
|
+
position: 'bottom-right', // 'bottom-left' | 'top-right' | 'top-left'
|
|
260
|
+
humanLabel: 'Human',
|
|
261
|
+
aiLabel: 'AI',
|
|
262
|
+
showBadge: true,
|
|
263
|
+
theme: {
|
|
264
|
+
background: 'rgba(18, 18, 24, 0.9)',
|
|
265
|
+
text: '#C0C0C5',
|
|
266
|
+
accent: '#E8E8EA',
|
|
267
|
+
badge: '#4ADE80',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Widget
|
|
274
|
+
|
|
275
|
+
The Human/AI widget is a floating toggle that lets visitors switch between the normal page and its AI-readable markdown version. Framework plugins (Astro, Vite, Nuxt, Angular) inject it automatically. For Next.js or manual setups:
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
// app/layout.tsx (or any client component)
|
|
279
|
+
'use client';
|
|
280
|
+
import { useEffect } from 'react';
|
|
281
|
+
|
|
282
|
+
export function AeoWidgetLoader() {
|
|
283
|
+
useEffect(() => {
|
|
284
|
+
import('aeo.js/widget').then(({ AeoWidget }) => {
|
|
285
|
+
new AeoWidget({
|
|
286
|
+
config: {
|
|
287
|
+
title: 'My Site',
|
|
288
|
+
url: 'https://mysite.com',
|
|
289
|
+
widget: { enabled: true, position: 'bottom-right' },
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}, []);
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
When a visitor clicks **AI**, the widget:
|
|
299
|
+
1. Fetches the `.md` file for the current page
|
|
300
|
+
2. Falls back to extracting markdown from the live DOM if no `.md` exists
|
|
301
|
+
3. Displays the markdown in a slide-out panel
|
|
302
|
+
4. Offers copy-to-clipboard and download actions
|
|
303
|
+
|
|
304
|
+
## Generated Files
|
|
305
|
+
|
|
306
|
+
After building, your output directory will contain:
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
public/
|
|
310
|
+
robots.txt # AI-crawler-aware directives
|
|
311
|
+
llms.txt # Short LLM-readable summary
|
|
312
|
+
llms-full.txt # Full content for LLMs
|
|
313
|
+
sitemap.xml # Standard sitemap
|
|
314
|
+
docs.json # Documentation manifest
|
|
315
|
+
ai-index.json # AI-optimized content index
|
|
316
|
+
index.md # Markdown for /
|
|
317
|
+
about.md # Markdown for /about
|
|
318
|
+
... # One .md per discovered page
|
|
319
|
+
```
|
|
320
|
+
|
|
24
321
|
## License
|
|
25
322
|
|
|
26
323
|
MIT
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { A as AeoConfig } from './types-Cn_Qbkmg.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate a widget script tag to inject into Angular's index.html.
|
|
5
|
+
* Returns HTML string to add before </body>.
|
|
6
|
+
*/
|
|
7
|
+
declare function getWidgetScript(config?: AeoConfig): string;
|
|
8
|
+
/**
|
|
9
|
+
* Post-build function for Angular projects.
|
|
10
|
+
* Scans the Angular build output directory for pre-rendered HTML,
|
|
11
|
+
* generates AEO files alongside the build output, and optionally
|
|
12
|
+
* injects the widget into index.html.
|
|
13
|
+
*
|
|
14
|
+
* Usage in package.json:
|
|
15
|
+
* "postbuild": "node -e \"import('aeo.js/angular').then(m => m.postBuild({ title: 'My App', url: 'https://mysite.com' }))\""
|
|
16
|
+
*
|
|
17
|
+
* Or with Angular SSR prerender:
|
|
18
|
+
* "postbuild": "node -e \"import('aeo.js/angular').then(m => m.postBuild({ title: 'My App', url: 'https://mysite.com', injectWidget: true }))\""
|
|
19
|
+
*/
|
|
20
|
+
declare function postBuild(config?: AeoConfig & {
|
|
21
|
+
injectWidget?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate AEO files for Angular from source routes only (no build output).
|
|
25
|
+
* Useful for dev/CI environments where build output isn't available.
|
|
26
|
+
*/
|
|
27
|
+
declare function generate(config?: AeoConfig): Promise<void>;
|
|
28
|
+
|
|
29
|
+
export { generate, getWidgetScript, postBuild };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { A as AeoConfig } from './types-Cn_Qbkmg.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate a widget script tag to inject into Angular's index.html.
|
|
5
|
+
* Returns HTML string to add before </body>.
|
|
6
|
+
*/
|
|
7
|
+
declare function getWidgetScript(config?: AeoConfig): string;
|
|
8
|
+
/**
|
|
9
|
+
* Post-build function for Angular projects.
|
|
10
|
+
* Scans the Angular build output directory for pre-rendered HTML,
|
|
11
|
+
* generates AEO files alongside the build output, and optionally
|
|
12
|
+
* injects the widget into index.html.
|
|
13
|
+
*
|
|
14
|
+
* Usage in package.json:
|
|
15
|
+
* "postbuild": "node -e \"import('aeo.js/angular').then(m => m.postBuild({ title: 'My App', url: 'https://mysite.com' }))\""
|
|
16
|
+
*
|
|
17
|
+
* Or with Angular SSR prerender:
|
|
18
|
+
* "postbuild": "node -e \"import('aeo.js/angular').then(m => m.postBuild({ title: 'My App', url: 'https://mysite.com', injectWidget: true }))\""
|
|
19
|
+
*/
|
|
20
|
+
declare function postBuild(config?: AeoConfig & {
|
|
21
|
+
injectWidget?: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Generate AEO files for Angular from source routes only (no build output).
|
|
25
|
+
* Useful for dev/CI environments where build output isn't available.
|
|
26
|
+
*/
|
|
27
|
+
declare function generate(config?: AeoConfig): Promise<void>;
|
|
28
|
+
|
|
29
|
+
export { generate, getWidgetScript, postBuild };
|