aeo.js 0.0.2 → 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 +132 -17
- 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 +8 -2
- package/dist/astro.d.ts +8 -2
- package/dist/astro.js +342 -100
- package/dist/astro.js.map +1 -1
- package/dist/astro.mjs +342 -100
- package/dist/astro.mjs.map +1 -1
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1880 -0
- 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 +178 -4
- package/dist/index.d.ts +178 -4
- package/dist/index.js +972 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +952 -20
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +2 -17
- package/dist/next.d.ts +2 -17
- package/dist/next.js +262 -73
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +262 -73
- package/dist/next.mjs.map +1 -1
- 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 +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/{types-BTY-v-7i.d.mts → types-Cn_Qbkmg.d.mts} +34 -0
- package/dist/{types-BTY-v-7i.d.ts → types-Cn_Qbkmg.d.ts} +34 -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 +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +178 -18
- package/dist/webpack.js.map +1 -1
- package/dist/webpack.mjs +178 -18
- package/dist/webpack.mjs.map +1 -1
- package/dist/widget.d.mts +1 -1
- package/dist/widget.d.ts +1 -1
- package/package.json +48 -2
package/README.md
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
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
|
|
|
@@ -19,16 +21,19 @@ aeo.js auto-generates the files these engines look for and provides a drop-in wi
|
|
|
19
21
|
- **`ai-index.json`** -- AI-optimized content index
|
|
20
22
|
- **Raw Markdown** -- Per-page `.md` files extracted from your HTML
|
|
21
23
|
- **Human/AI Widget** -- Drop-in toggle showing the AI-readable version of any page
|
|
24
|
+
- **CLI** -- `npx aeo.js generate` to run standalone
|
|
22
25
|
|
|
23
26
|
## Supported Frameworks
|
|
24
27
|
|
|
25
28
|
| Framework | Status | Import |
|
|
26
29
|
|-----------|--------|--------|
|
|
27
|
-
| Next.js | Stable | `aeo.js/next` |
|
|
28
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` |
|
|
29
35
|
| Webpack | Stable | `aeo.js/webpack` |
|
|
30
|
-
|
|
|
31
|
-
| Nuxt | Coming soon | -- |
|
|
36
|
+
| Any (CLI) | Stable | `npx aeo.js generate` |
|
|
32
37
|
|
|
33
38
|
## Install
|
|
34
39
|
|
|
@@ -38,6 +43,27 @@ npm install aeo.js
|
|
|
38
43
|
|
|
39
44
|
## Quick Start
|
|
40
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
|
+
|
|
41
67
|
### Next.js
|
|
42
68
|
|
|
43
69
|
Wrap your Next.js config with `withAeo`:
|
|
@@ -65,19 +91,16 @@ After building, run the post-build step to extract content from pre-rendered pag
|
|
|
65
91
|
}
|
|
66
92
|
```
|
|
67
93
|
|
|
68
|
-
###
|
|
69
|
-
|
|
70
|
-
Add the integration in your Astro config:
|
|
94
|
+
### Vite (React, Vue, Svelte, etc.)
|
|
71
95
|
|
|
72
96
|
```js
|
|
73
|
-
//
|
|
74
|
-
import { defineConfig } from '
|
|
75
|
-
import {
|
|
97
|
+
// vite.config.ts
|
|
98
|
+
import { defineConfig } from 'vite';
|
|
99
|
+
import { aeoVitePlugin } from 'aeo.js/vite';
|
|
76
100
|
|
|
77
101
|
export default defineConfig({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
aeoAstroIntegration({
|
|
102
|
+
plugins: [
|
|
103
|
+
aeoVitePlugin({
|
|
81
104
|
title: 'My Site',
|
|
82
105
|
description: 'A site optimized for AI discovery',
|
|
83
106
|
url: 'https://mysite.com',
|
|
@@ -86,9 +109,62 @@ export default defineConfig({
|
|
|
86
109
|
});
|
|
87
110
|
```
|
|
88
111
|
|
|
89
|
-
|
|
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
|
|
90
117
|
|
|
91
|
-
|
|
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
|
|
92
168
|
|
|
93
169
|
```js
|
|
94
170
|
// webpack.config.js
|
|
@@ -105,8 +181,47 @@ module.exports = {
|
|
|
105
181
|
};
|
|
106
182
|
```
|
|
107
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
|
+
|
|
108
221
|
## Configuration
|
|
109
222
|
|
|
223
|
+
All framework plugins accept the same config object. You can also use `defineConfig` for standalone configs:
|
|
224
|
+
|
|
110
225
|
```js
|
|
111
226
|
import { defineConfig } from 'aeo.js';
|
|
112
227
|
|
|
@@ -157,7 +272,7 @@ export default defineConfig({
|
|
|
157
272
|
|
|
158
273
|
## Widget
|
|
159
274
|
|
|
160
|
-
The Human/AI widget is a floating toggle that lets visitors switch between the normal page and its AI-readable markdown version.
|
|
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:
|
|
161
276
|
|
|
162
277
|
```tsx
|
|
163
278
|
// app/layout.tsx (or any client component)
|
|
@@ -183,7 +298,7 @@ export function AeoWidgetLoader() {
|
|
|
183
298
|
When a visitor clicks **AI**, the widget:
|
|
184
299
|
1. Fetches the `.md` file for the current page
|
|
185
300
|
2. Falls back to extracting markdown from the live DOM if no `.md` exists
|
|
186
|
-
3. Displays the markdown
|
|
301
|
+
3. Displays the markdown in a slide-out panel
|
|
187
302
|
4. Offers copy-to-clipboard and download actions
|
|
188
303
|
|
|
189
304
|
## Generated Files
|
|
@@ -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 };
|