@agent-seo/next 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +90 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @agent-seo/next
2
+
3
+ Next.js plugin for AI-readable websites. Zero-config `/llms.txt`, automatic HTML-to-Markdown for AI bots.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @agent-seo/next
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ **`next.config.ts`** — wrap your config:
14
+
15
+ ```typescript
16
+ import { withAgentSeo } from '@agent-seo/next';
17
+
18
+ export default withAgentSeo({
19
+ siteName: 'My App',
20
+ siteDescription: 'A brief description for AI systems.',
21
+ baseUrl: 'https://myapp.com',
22
+ sitemap: true,
23
+ })({
24
+ // your existing Next.js config
25
+ });
26
+ ```
27
+
28
+ **`middleware.ts`** — enable AI bot detection:
29
+
30
+ ```typescript
31
+ import { createAgentSeoMiddleware } from '@agent-seo/next/middleware';
32
+
33
+ export default createAgentSeoMiddleware({
34
+ exclude: ['/dashboard/**', '/admin/**'],
35
+ });
36
+
37
+ export const config = {
38
+ matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'],
39
+ };
40
+ ```
41
+
42
+ That's it. Two files, ~10 lines total.
43
+
44
+ ## What It Does Automatically
45
+
46
+ - **Auto-generates `/llms.txt`** by scanning your `app/` directory and extracting `metadata` (title, description)
47
+ - **Auto-generates a transform API route** that converts HTML to Markdown on the fly
48
+ - **Auto-generates `robots.txt`** with an AI-friendly config pointing to `/llms.txt`
49
+ - **Detects 19 AI bots** via User-Agent and rewrites their requests to serve Markdown
50
+ - **Handles `.md` suffix** requests (e.g., `/about.md` returns Markdown)
51
+ - **Injects `Vary: Accept, User-Agent`** headers for correct CDN caching
52
+ - **Sets bot-friendly headers** — `Content-Disposition: inline`, `X-Robots-Tag: all`
53
+
54
+ ## How It Works
55
+
56
+ ```
57
+ Browser → GET /about → HTML (normal)
58
+ GPTBot → GET /about → Markdown (automatic)
59
+ Anyone → GET /about.md → Markdown (explicit)
60
+ Anyone → GET /llms.txt → Site directory for AI agents
61
+ ```
62
+
63
+ ## Plugin Options
64
+
65
+ | Option | Type | Description |
66
+ | ----------------- | ------------------- | ----------------------------------------------------------------------------------------- |
67
+ | `siteName` | `string` | Your site name (used in `llms.txt`) |
68
+ | `siteDescription` | `string` | Brief description for AI systems |
69
+ | `baseUrl` | `string` | Your site's public URL |
70
+ | `sitemap` | `boolean \| string` | Add `Sitemap:` to `robots.txt`. `true` uses `{baseUrl}/sitemap.xml`, or pass a custom URL |
71
+ | `appDir` | `string` | Override auto-detected `app/` directory path |
72
+ | `exclude` | `string[]` | Route patterns to exclude from `llms.txt` discovery |
73
+
74
+ ## Middleware Options
75
+
76
+ ```typescript
77
+ createAgentSeoMiddleware({
78
+ exclude: [
79
+ '/dashboard/**',
80
+ '/admin/**',
81
+ '/api/private/**',
82
+ ],
83
+ });
84
+ ```
85
+
86
+ Built-in defaults always excluded: `/api/**`, `/_next/**`, `/robots.txt`, `/sitemap.xml`, `/favicon.ico`, `/llms.txt`.
87
+
88
+ ## License
89
+
90
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-seo/next",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Next.js plugin for AI-readable websites",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -54,7 +54,7 @@
54
54
  "dist"
55
55
  ],
56
56
  "dependencies": {
57
- "@agent-seo/core": "1.0.0"
57
+ "@agent-seo/core": "1.0.1"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "next": "^14.0.0 || ^15.0.0 || ^16.0.0"