@vercel/geistdocs 2.0.2 → 2.1.0
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/dist/cli/index.js +1 -1
- package/dist/internal/page-tree-visibility.d.ts +4 -0
- package/dist/internal/page-tree-visibility.d.ts.map +1 -0
- package/dist/internal/page-tree-visibility.js +42 -0
- package/dist/page-visibility.d.ts +7 -0
- package/dist/page-visibility.d.ts.map +1 -1
- package/dist/pages/docs.d.ts +23 -21
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +44 -15
- package/dist/proxy.d.ts +4 -1
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +42 -12
- package/dist/routes/chat.d.ts +4 -1
- package/dist/routes/chat.d.ts.map +1 -1
- package/dist/routes/chat.js +58 -25
- package/dist/routes/llms.d.ts +14 -10
- package/dist/routes/llms.d.ts.map +1 -1
- package/dist/routes/llms.js +50 -8
- package/dist/routes/search-export.d.ts +3 -1
- package/dist/routes/search-export.d.ts.map +1 -1
- package/dist/routes/search-export.js +4 -3
- package/dist/routes/search.d.ts +3 -1
- package/dist/routes/search.d.ts.map +1 -1
- package/dist/routes/search.js +4 -3
- package/dist/routes/sitemap.d.ts +3 -2
- package/dist/routes/sitemap.d.ts.map +1 -1
- package/dist/routes/sitemap.js +7 -4
- package/dist/source.d.ts +1 -0
- package/dist/source.d.ts.map +1 -1
- package/docs/agents.md +1 -1
- package/docs/llms.txt +74 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +53 -0
- package/docs/pages/llms-txt.md +2 -0
- package/docs/pages/md.md +4 -0
- package/docs/pages/proxy.md +14 -0
- package/package.json +1 -1
- package/template/AGENTS.md +2 -1
- package/template/content/docs/configuration.mdx +53 -0
- package/template/content/docs/llms-txt.mdx +2 -0
- package/template/content/docs/md.mdx +4 -0
- package/template/content/docs/proxy.mdx +14 -0
- package/template/package.json +1 -1
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.0
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.1.0 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.0.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.1.0.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -1351,6 +1351,59 @@ excludeFrom:
|
|
|
1351
1351
|
|
|
1352
1352
|
Optional `tags`, `keywords`, and `canonical` frontmatter are also recognized by the package runtime.
|
|
1353
1353
|
|
|
1354
|
+
### Gate page access per request
|
|
1355
|
+
|
|
1356
|
+
Use `createDocsPage({ canViewPage })` when route state, authentication, or another request-specific policy controls access to HTML pages. A denied page returns the standard Next.js not-found response. The same policy filters page metadata, breadcrumbs, previous and next links, and the tree returned by `getPageTree`.
|
|
1357
|
+
|
|
1358
|
+
Keep the page factory in a shared app-owned module so the page and layout use the same policy:
|
|
1359
|
+
|
|
1360
|
+
```tsx title="lib/geistdocs/docs-page.tsx"
|
|
1361
|
+
import {
|
|
1362
|
+
createDocsPage,
|
|
1363
|
+
type DocsPageParams,
|
|
1364
|
+
} from "@vercel/geistdocs/pages/docs";
|
|
1365
|
+
import { config } from "./config";
|
|
1366
|
+
import { geistdocsSource } from "./source";
|
|
1367
|
+
|
|
1368
|
+
interface PageParams extends DocsPageParams {
|
|
1369
|
+
audience: string;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
export const docsPage = createDocsPage<PageParams>({
|
|
1373
|
+
config,
|
|
1374
|
+
source: geistdocsSource,
|
|
1375
|
+
canViewPage: (page, { params }) =>
|
|
1376
|
+
page.data.preview !== true || params.audience === "preview",
|
|
1377
|
+
});
|
|
1378
|
+
```
|
|
1379
|
+
|
|
1380
|
+
Use `docsPage.getPageTree(params)` for the layout tree instead of reading the source tree directly:
|
|
1381
|
+
|
|
1382
|
+
```tsx title="app/[lang]/[audience]/docs/layout.tsx"
|
|
1383
|
+
import { DocsLayout } from "@/components/geistdocs/docs-layout";
|
|
1384
|
+
import { docsPage } from "@/lib/geistdocs/docs-page";
|
|
1385
|
+
|
|
1386
|
+
const Layout = async ({
|
|
1387
|
+
children,
|
|
1388
|
+
params,
|
|
1389
|
+
}: LayoutProps<"/[lang]/[audience]/docs">) => (
|
|
1390
|
+
<DocsLayout tree={await docsPage.getPageTree(await params)}>
|
|
1391
|
+
{children}
|
|
1392
|
+
</DocsLayout>
|
|
1393
|
+
);
|
|
1394
|
+
|
|
1395
|
+
export default Layout;
|
|
1396
|
+
```
|
|
1397
|
+
|
|
1398
|
+
`canViewPage` controls request-specific HTML access. Machine-readable indexes and Ask AI need one stable, cacheable public corpus. Define a synchronous `filterPublicPage` function. Pass it as `canViewPage` to `createDocsMarkdownRoute`, and as `filterPage` to `createLlmsRoute`, `createSitemapMarkdownRoute`, `createSearchRoute`, `createSearchExportRoute`, and `createChatRoute`:
|
|
1399
|
+
|
|
1400
|
+
```ts title="lib/geistdocs/page-access.ts"
|
|
1401
|
+
export const filterPublicPage = (page: { data: { preview?: boolean } }) =>
|
|
1402
|
+
page.data.preview !== true;
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
Consumers choose the frontmatter field and access provider. Geistdocs does not require a specific authentication or feature flag system.
|
|
1406
|
+
|
|
1354
1407
|
## Last modified dates
|
|
1355
1408
|
|
|
1356
1409
|
`sitemap.md` entries include a `Lastmod` field and RSS items carry a publish date when a page has a last-modified date. Geistdocs resolves the date for each page in this order:
|
|
@@ -2593,6 +2646,20 @@ const proxy = createProxy({
|
|
|
2593
2646
|
});
|
|
2594
2647
|
```
|
|
2595
2648
|
|
|
2649
|
+
Use `transformRewrite` when every package-owned HTML and Markdown destination needs an internal route segment. Geistdocs resolves Markdown negotiation and the locale first, then passes the app-local destination to the callback. Geistdocs continues to apply the configured base path, query string, and representation headers.
|
|
2650
|
+
|
|
2651
|
+
```ts title="proxy.ts"
|
|
2652
|
+
const proxy = createProxy({
|
|
2653
|
+
config: geistdocsConfig,
|
|
2654
|
+
transformRewrite: async (pathname, { request }) => {
|
|
2655
|
+
const segment = await resolveRouteSegment(request);
|
|
2656
|
+
return `/${segment}${pathname}`;
|
|
2657
|
+
},
|
|
2658
|
+
});
|
|
2659
|
+
```
|
|
2660
|
+
|
|
2661
|
+
For example, an HTML request for `/docs/functions` passes `/en/docs/functions`, while its Markdown representation passes `/en/llms.mdx/functions`. The callback must return an app-local path that starts with `/`. Avoid network work that does not belong on every matched request.
|
|
2662
|
+
|
|
2596
2663
|
## Markdown route mappings
|
|
2597
2664
|
|
|
2598
2665
|
Define `content` sections in `lib/geistdocs/config.tsx` to infer standard Markdown route mappings from each section route. The package still serves `/llms.txt` and individual page Markdown through route helpers; the proxy uses these mappings for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
|
|
@@ -3203,14 +3270,18 @@ The destination route uses `createDocsMarkdownRoute` to process the page and ret
|
|
|
3203
3270
|
|
|
3204
3271
|
```ts title="app/[lang]/llms.mdx/[[...slug]]/route.ts"
|
|
3205
3272
|
import { createDocsMarkdownRoute } from "@vercel/geistdocs/routes/llms";
|
|
3273
|
+
import { filterPublicPage } from "@/lib/geistdocs/page-access";
|
|
3206
3274
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
3207
3275
|
|
|
3208
3276
|
export const { GET, generateStaticParams } =
|
|
3209
3277
|
createDocsMarkdownRoute({
|
|
3210
3278
|
sources: [geistdocsSource],
|
|
3279
|
+
canViewPage: filterPublicPage,
|
|
3211
3280
|
});
|
|
3212
3281
|
```
|
|
3213
3282
|
|
|
3283
|
+
Pass the same stable public filter to `createDocsMarkdownRoute` that you use for `llms.txt`, sitemap, search, search export, and Ask AI. When `canViewPage` denies an existing page, Geistdocs returns the same `404` response as a missing page, omits its canonical header and content, and removes it from suggested pages. Configuring `canViewPage` also keeps missing responses at `404`, even when `notFound.status` is `410`, so response status cannot reveal whether a denied page exists.
|
|
3284
|
+
|
|
3214
3285
|
Read [Proxy and markdown routes](/docs/proxy) to configure additional route families such as `/cookbook` or `/v5/docs`.
|
|
3215
3286
|
|
|
3216
3287
|
## Response Format
|
|
@@ -4398,6 +4469,8 @@ export const { GET } = createLlmsRoute({
|
|
|
4398
4469
|
});
|
|
4399
4470
|
```
|
|
4400
4471
|
|
|
4472
|
+
`filterPage` receives the page plus its language and source. Use the same synchronous filter function for every public aggregate route so `/llms.txt`, `sitemap.md`, local search, Mixedbread search export, and Ask AI expose the same cacheable page set. Pass that function as `canViewPage` to `createDocsMarkdownRoute`. Request-specific HTML access belongs in `createDocsPage({ canViewPage })`; do not personalize public indexes.
|
|
4473
|
+
|
|
4401
4474
|
## The llms.txt standard
|
|
4402
4475
|
|
|
4403
4476
|
The llms.txt standard is a simple convention that makes documentation more accessible to AI tools. It's similar in spirit to `robots.txt` but designed for language models instead of search crawlers.
|
package/docs/manifest.json
CHANGED
|
@@ -289,6 +289,59 @@ excludeFrom:
|
|
|
289
289
|
|
|
290
290
|
Optional `tags`, `keywords`, and `canonical` frontmatter are also recognized by the package runtime.
|
|
291
291
|
|
|
292
|
+
### Gate page access per request
|
|
293
|
+
|
|
294
|
+
Use `createDocsPage({ canViewPage })` when route state, authentication, or another request-specific policy controls access to HTML pages. A denied page returns the standard Next.js not-found response. The same policy filters page metadata, breadcrumbs, previous and next links, and the tree returned by `getPageTree`.
|
|
295
|
+
|
|
296
|
+
Keep the page factory in a shared app-owned module so the page and layout use the same policy:
|
|
297
|
+
|
|
298
|
+
```tsx title="lib/geistdocs/docs-page.tsx"
|
|
299
|
+
import {
|
|
300
|
+
createDocsPage,
|
|
301
|
+
type DocsPageParams,
|
|
302
|
+
} from "@vercel/geistdocs/pages/docs";
|
|
303
|
+
import { config } from "./config";
|
|
304
|
+
import { geistdocsSource } from "./source";
|
|
305
|
+
|
|
306
|
+
interface PageParams extends DocsPageParams {
|
|
307
|
+
audience: string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export const docsPage = createDocsPage<PageParams>({
|
|
311
|
+
config,
|
|
312
|
+
source: geistdocsSource,
|
|
313
|
+
canViewPage: (page, { params }) =>
|
|
314
|
+
page.data.preview !== true || params.audience === "preview",
|
|
315
|
+
});
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Use `docsPage.getPageTree(params)` for the layout tree instead of reading the source tree directly:
|
|
319
|
+
|
|
320
|
+
```tsx title="app/[lang]/[audience]/docs/layout.tsx"
|
|
321
|
+
import { DocsLayout } from "@/components/geistdocs/docs-layout";
|
|
322
|
+
import { docsPage } from "@/lib/geistdocs/docs-page";
|
|
323
|
+
|
|
324
|
+
const Layout = async ({
|
|
325
|
+
children,
|
|
326
|
+
params,
|
|
327
|
+
}: LayoutProps<"/[lang]/[audience]/docs">) => (
|
|
328
|
+
<DocsLayout tree={await docsPage.getPageTree(await params)}>
|
|
329
|
+
{children}
|
|
330
|
+
</DocsLayout>
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
export default Layout;
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`canViewPage` controls request-specific HTML access. Machine-readable indexes and Ask AI need one stable, cacheable public corpus. Define a synchronous `filterPublicPage` function. Pass it as `canViewPage` to `createDocsMarkdownRoute`, and as `filterPage` to `createLlmsRoute`, `createSitemapMarkdownRoute`, `createSearchRoute`, `createSearchExportRoute`, and `createChatRoute`:
|
|
337
|
+
|
|
338
|
+
```ts title="lib/geistdocs/page-access.ts"
|
|
339
|
+
export const filterPublicPage = (page: { data: { preview?: boolean } }) =>
|
|
340
|
+
page.data.preview !== true;
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
Consumers choose the frontmatter field and access provider. Geistdocs does not require a specific authentication or feature flag system.
|
|
344
|
+
|
|
292
345
|
## Last modified dates
|
|
293
346
|
|
|
294
347
|
`sitemap.md` entries include a `Lastmod` field and RSS items carry a publish date when a page has a last-modified date. Geistdocs resolves the date for each page in this order:
|
package/docs/pages/llms-txt.md
CHANGED
|
@@ -82,6 +82,8 @@ export const { GET } = createLlmsRoute({
|
|
|
82
82
|
});
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
`filterPage` receives the page plus its language and source. Use the same synchronous filter function for every public aggregate route so `/llms.txt`, `sitemap.md`, local search, Mixedbread search export, and Ask AI expose the same cacheable page set. Pass that function as `canViewPage` to `createDocsMarkdownRoute`. Request-specific HTML access belongs in `createDocsPage({ canViewPage })`; do not personalize public indexes.
|
|
86
|
+
|
|
85
87
|
## The llms.txt standard
|
|
86
88
|
|
|
87
89
|
The llms.txt standard is a simple convention that makes documentation more accessible to AI tools. It's similar in spirit to `robots.txt` but designed for language models instead of search crawlers.
|
package/docs/pages/md.md
CHANGED
|
@@ -67,14 +67,18 @@ The destination route uses `createDocsMarkdownRoute` to process the page and ret
|
|
|
67
67
|
|
|
68
68
|
```ts title="app/[lang]/llms.mdx/[[...slug]]/route.ts"
|
|
69
69
|
import { createDocsMarkdownRoute } from "@vercel/geistdocs/routes/llms";
|
|
70
|
+
import { filterPublicPage } from "@/lib/geistdocs/page-access";
|
|
70
71
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
71
72
|
|
|
72
73
|
export const { GET, generateStaticParams } =
|
|
73
74
|
createDocsMarkdownRoute({
|
|
74
75
|
sources: [geistdocsSource],
|
|
76
|
+
canViewPage: filterPublicPage,
|
|
75
77
|
});
|
|
76
78
|
```
|
|
77
79
|
|
|
80
|
+
Pass the same stable public filter to `createDocsMarkdownRoute` that you use for `llms.txt`, sitemap, search, search export, and Ask AI. When `canViewPage` denies an existing page, Geistdocs returns the same `404` response as a missing page, omits its canonical header and content, and removes it from suggested pages. Configuring `canViewPage` also keeps missing responses at `404`, even when `notFound.status` is `410`, so response status cannot reveal whether a denied page exists.
|
|
81
|
+
|
|
78
82
|
Read [Proxy and markdown routes](/docs/proxy) to configure additional route families such as `/cookbook` or `/v5/docs`.
|
|
79
83
|
|
|
80
84
|
## Response Format
|
package/docs/pages/proxy.md
CHANGED
|
@@ -85,6 +85,20 @@ const proxy = createProxy({
|
|
|
85
85
|
});
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
Use `transformRewrite` when every package-owned HTML and Markdown destination needs an internal route segment. Geistdocs resolves Markdown negotiation and the locale first, then passes the app-local destination to the callback. Geistdocs continues to apply the configured base path, query string, and representation headers.
|
|
89
|
+
|
|
90
|
+
```ts title="proxy.ts"
|
|
91
|
+
const proxy = createProxy({
|
|
92
|
+
config: geistdocsConfig,
|
|
93
|
+
transformRewrite: async (pathname, { request }) => {
|
|
94
|
+
const segment = await resolveRouteSegment(request);
|
|
95
|
+
return `/${segment}${pathname}`;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For example, an HTML request for `/docs/functions` passes `/en/docs/functions`, while its Markdown representation passes `/en/llms.mdx/functions`. The callback must return an app-local path that starts with `/`. Avoid network work that does not belong on every matched request.
|
|
101
|
+
|
|
88
102
|
## Markdown route mappings
|
|
89
103
|
|
|
90
104
|
Define `content` sections in `lib/geistdocs/config.tsx` to infer standard Markdown route mappings from each section route. The package still serves `/llms.txt` and individual page Markdown through route helpers; the proxy uses these mappings for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
|
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -61,9 +61,10 @@ Use these instructions when an AI coding agent edits this project.
|
|
|
61
61
|
- Use proxy matcher exclusions that only match `/api` and `/api/...`, such as `api(?:/|$)`. Do not exclude broad prefixes like `api`, because that also excludes routes such as `/api-reference`.
|
|
62
62
|
- Preserve markdown negotiation unless the task explicitly changes AI-readable output. Geistdocs serves `/agents.md`, `/llms.txt`, `/.well-known/mcp.json`, and per-page Markdown for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
|
|
63
63
|
- Restart `next dev` after adding, deleting, or renaming an App Router page or route so `createGeistdocs` regenerates its route manifest.
|
|
64
|
-
- When adding custom proxy behavior, prefer `before`, `after`, and `markdownRoutes` options on `createProxy` instead of replacing the proxy.
|
|
64
|
+
- When adding custom proxy behavior, prefer `before`, `after`, `transformRewrite`, and `markdownRoutes` options on `createProxy` instead of replacing the proxy. Use `transformRewrite` for internal route segments that must apply after locale and Markdown resolution.
|
|
65
65
|
- Use explicit `markdownRoutes` for root-mounted docs or any site where homepage/app routes coexist with docs routes.
|
|
66
66
|
- Keep source URLs, navigation links, `getPageUrl`, and `markdownRoutes` app-local when `config.basePath` is set. Geistdocs derives public page-action and Markdown URLs separately.
|
|
67
|
+
- Use `createDocsPage({ canViewPage })` and its returned `getPageTree(params)` for request-specific page access. Use one synchronous public filter as `canViewPage` for per-page Markdown and as `filterPage` for llms.txt, sitemap, search, search export, and chat routes.
|
|
67
68
|
- Include `"/"` explicitly in the static proxy matcher when a Next.js base-path application serves documentation at its app root.
|
|
68
69
|
|
|
69
70
|
## Ask AI and Vertex proxy guidelines
|
|
@@ -287,6 +287,59 @@ excludeFrom:
|
|
|
287
287
|
|
|
288
288
|
Optional `tags`, `keywords`, and `canonical` frontmatter are also recognized by the package runtime.
|
|
289
289
|
|
|
290
|
+
### Gate page access per request
|
|
291
|
+
|
|
292
|
+
Use `createDocsPage({ canViewPage })` when route state, authentication, or another request-specific policy controls access to HTML pages. A denied page returns the standard Next.js not-found response. The same policy filters page metadata, breadcrumbs, previous and next links, and the tree returned by `getPageTree`.
|
|
293
|
+
|
|
294
|
+
Keep the page factory in a shared app-owned module so the page and layout use the same policy:
|
|
295
|
+
|
|
296
|
+
```tsx title="lib/geistdocs/docs-page.tsx"
|
|
297
|
+
import {
|
|
298
|
+
createDocsPage,
|
|
299
|
+
type DocsPageParams,
|
|
300
|
+
} from "@vercel/geistdocs/pages/docs";
|
|
301
|
+
import { config } from "./config";
|
|
302
|
+
import { geistdocsSource } from "./source";
|
|
303
|
+
|
|
304
|
+
interface PageParams extends DocsPageParams {
|
|
305
|
+
audience: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export const docsPage = createDocsPage<PageParams>({
|
|
309
|
+
config,
|
|
310
|
+
source: geistdocsSource,
|
|
311
|
+
canViewPage: (page, { params }) =>
|
|
312
|
+
page.data.preview !== true || params.audience === "preview",
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Use `docsPage.getPageTree(params)` for the layout tree instead of reading the source tree directly:
|
|
317
|
+
|
|
318
|
+
```tsx title="app/[lang]/[audience]/docs/layout.tsx"
|
|
319
|
+
import { DocsLayout } from "@/components/geistdocs/docs-layout";
|
|
320
|
+
import { docsPage } from "@/lib/geistdocs/docs-page";
|
|
321
|
+
|
|
322
|
+
const Layout = async ({
|
|
323
|
+
children,
|
|
324
|
+
params,
|
|
325
|
+
}: LayoutProps<"/[lang]/[audience]/docs">) => (
|
|
326
|
+
<DocsLayout tree={await docsPage.getPageTree(await params)}>
|
|
327
|
+
{children}
|
|
328
|
+
</DocsLayout>
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
export default Layout;
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`canViewPage` controls request-specific HTML access. Machine-readable indexes and Ask AI need one stable, cacheable public corpus. Define a synchronous `filterPublicPage` function. Pass it as `canViewPage` to `createDocsMarkdownRoute`, and as `filterPage` to `createLlmsRoute`, `createSitemapMarkdownRoute`, `createSearchRoute`, `createSearchExportRoute`, and `createChatRoute`:
|
|
335
|
+
|
|
336
|
+
```ts title="lib/geistdocs/page-access.ts"
|
|
337
|
+
export const filterPublicPage = (page: { data: { preview?: boolean } }) =>
|
|
338
|
+
page.data.preview !== true;
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Consumers choose the frontmatter field and access provider. Geistdocs does not require a specific authentication or feature flag system.
|
|
342
|
+
|
|
290
343
|
## Last modified dates
|
|
291
344
|
|
|
292
345
|
`sitemap.md` entries include a `Lastmod` field and RSS items carry a publish date when a page has a last-modified date. Geistdocs resolves the date for each page in this order:
|
|
@@ -80,6 +80,8 @@ export const { GET } = createLlmsRoute({
|
|
|
80
80
|
});
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
`filterPage` receives the page plus its language and source. Use the same synchronous filter function for every public aggregate route so `/llms.txt`, `sitemap.md`, local search, Mixedbread search export, and Ask AI expose the same cacheable page set. Pass that function as `canViewPage` to `createDocsMarkdownRoute`. Request-specific HTML access belongs in `createDocsPage({ canViewPage })`; do not personalize public indexes.
|
|
84
|
+
|
|
83
85
|
## The llms.txt standard
|
|
84
86
|
|
|
85
87
|
The llms.txt standard is a simple convention that makes documentation more accessible to AI tools. It's similar in spirit to `robots.txt` but designed for language models instead of search crawlers.
|
|
@@ -65,14 +65,18 @@ The destination route uses `createDocsMarkdownRoute` to process the page and ret
|
|
|
65
65
|
|
|
66
66
|
```ts title="app/[lang]/llms.mdx/[[...slug]]/route.ts"
|
|
67
67
|
import { createDocsMarkdownRoute } from "@vercel/geistdocs/routes/llms";
|
|
68
|
+
import { filterPublicPage } from "@/lib/geistdocs/page-access";
|
|
68
69
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
69
70
|
|
|
70
71
|
export const { GET, generateStaticParams } =
|
|
71
72
|
createDocsMarkdownRoute({
|
|
72
73
|
sources: [geistdocsSource],
|
|
74
|
+
canViewPage: filterPublicPage,
|
|
73
75
|
});
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
Pass the same stable public filter to `createDocsMarkdownRoute` that you use for `llms.txt`, sitemap, search, search export, and Ask AI. When `canViewPage` denies an existing page, Geistdocs returns the same `404` response as a missing page, omits its canonical header and content, and removes it from suggested pages. Configuring `canViewPage` also keeps missing responses at `404`, even when `notFound.status` is `410`, so response status cannot reveal whether a denied page exists.
|
|
79
|
+
|
|
76
80
|
Read [Proxy and markdown routes](/docs/proxy) to configure additional route families such as `/cookbook` or `/v5/docs`.
|
|
77
81
|
|
|
78
82
|
## Response Format
|
|
@@ -83,6 +83,20 @@ const proxy = createProxy({
|
|
|
83
83
|
});
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
Use `transformRewrite` when every package-owned HTML and Markdown destination needs an internal route segment. Geistdocs resolves Markdown negotiation and the locale first, then passes the app-local destination to the callback. Geistdocs continues to apply the configured base path, query string, and representation headers.
|
|
87
|
+
|
|
88
|
+
```ts title="proxy.ts"
|
|
89
|
+
const proxy = createProxy({
|
|
90
|
+
config: geistdocsConfig,
|
|
91
|
+
transformRewrite: async (pathname, { request }) => {
|
|
92
|
+
const segment = await resolveRouteSegment(request);
|
|
93
|
+
return `/${segment}${pathname}`;
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
For example, an HTML request for `/docs/functions` passes `/en/docs/functions`, while its Markdown representation passes `/en/llms.mdx/functions`. The callback must return an app-local path that starts with `/`. Avoid network work that does not belong on every matched request.
|
|
99
|
+
|
|
86
100
|
## Markdown route mappings
|
|
87
101
|
|
|
88
102
|
Define `content` sections in `lib/geistdocs/config.tsx` to infer standard Markdown route mappings from each section route. The package still serves `/llms.txt` and individual page Markdown through route helpers; the proxy uses these mappings for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
|
package/template/package.json
CHANGED