@vercel/geistdocs 2.0.2 → 2.2.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/components/link.d.ts +5 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +4 -0
- package/dist/internal/docs-link-class-name.d.ts +2 -0
- package/dist/internal/docs-link-class-name.d.ts.map +1 -0
- package/dist/internal/docs-link-class-name.js +3 -0
- 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 +25 -21
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +53 -17
- 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 +114 -3
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +53 -0
- package/docs/pages/getting-started.md +8 -0
- package/docs/pages/llms-txt.md +2 -0
- package/docs/pages/md.md +4 -0
- package/docs/pages/packages.md +6 -2
- package/docs/pages/proxy.md +14 -0
- package/docs/pages/syntax.md +26 -0
- package/package.json +5 -1
- package/template/AGENTS.md +2 -1
- package/template/app/styles/geistdocs.css +2 -2
- package/template/content/docs/configuration.mdx +53 -0
- package/template/content/docs/getting-started.mdx +9 -0
- package/template/content/docs/llms-txt.mdx +2 -0
- package/template/content/docs/md.mdx +4 -0
- package/template/content/docs/packages.mdx +6 -2
- package/template/content/docs/proxy.mdx +14 -0
- package/template/content/docs/syntax.mdx +26 -0
- package/template/package.json +1 -1
package/dist/source.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ export declare const createSource: ({ docs, config, baseUrl, id, label, markdown
|
|
|
95
95
|
}>>) => Promise<string>;
|
|
96
96
|
};
|
|
97
97
|
export type GeistdocsSourceBundle = ReturnType<typeof createSource>;
|
|
98
|
+
export type GeistdocsSourcePage = ReturnType<GeistdocsSourceBundle["source"]["getPages"]>[number];
|
|
98
99
|
export declare const isGeistdocsSourceBundle: (source: unknown) => source is GeistdocsSourceBundle;
|
|
99
100
|
export declare const createSources: ({ config, sources }: CreateSourcesOptions) => {
|
|
100
101
|
all: {
|
package/dist/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AA0FlD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C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BATrC,aAAa;;;WAAe;;;;gCASnB,aAAa;;;WAAe;;;;;;;;;;;;;;;;;;6BATrC,aAAa;;;WAAe;;;;gCASnB,aAAa;;;WAAe;;;CAwLlE,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,EAAE,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,MAAM,CAAC;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,EAAE,CAAC;CAC1D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAI,6CAKjC,0BAA0B,KAAG,MAAM,EAYrC,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAC/C,UAAU,CAAC,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAAE,KAAK,CAAC,CAAC;CAClE;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,iCAIvC,gCAAgC,KAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAiBvE,CAAC"}
|
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.2.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.2.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
|
|
@@ -156,6 +156,14 @@ related:
|
|
|
156
156
|
|
|
157
157
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
158
158
|
|
|
159
|
+
> Note:
|
|
160
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
161
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
162
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
163
|
+
repositories with external contributors, and all other projects must use the
|
|
164
|
+
public `@vercel/geistdocs` package. See
|
|
165
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
166
|
+
|
|
159
167
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
160
168
|
|
|
161
169
|
## Prerequisites
|
|
@@ -1020,7 +1028,11 @@ related:
|
|
|
1020
1028
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
1021
1029
|
|
|
1022
1030
|
> Note:
|
|
1023
|
-
`@vercel/geistdocs-private`
|
|
1031
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
1032
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
1033
|
+
repositories and projects with external contributors must use
|
|
1034
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
1035
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
1024
1036
|
|
|
1025
1037
|
| Package | Access | UI provider | Recommended use |
|
|
1026
1038
|
| --- | --- | --- | --- |
|
|
@@ -1047,7 +1059,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
1047
1059
|
|
|
1048
1060
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
1049
1061
|
|
|
1050
|
-
The private
|
|
1062
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
1051
1063
|
|
|
1052
1064
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
1053
1065
|
|
|
@@ -1351,6 +1363,59 @@ excludeFrom:
|
|
|
1351
1363
|
|
|
1352
1364
|
Optional `tags`, `keywords`, and `canonical` frontmatter are also recognized by the package runtime.
|
|
1353
1365
|
|
|
1366
|
+
### Gate page access per request
|
|
1367
|
+
|
|
1368
|
+
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`.
|
|
1369
|
+
|
|
1370
|
+
Keep the page factory in a shared app-owned module so the page and layout use the same policy:
|
|
1371
|
+
|
|
1372
|
+
```tsx title="lib/geistdocs/docs-page.tsx"
|
|
1373
|
+
import {
|
|
1374
|
+
createDocsPage,
|
|
1375
|
+
type DocsPageParams,
|
|
1376
|
+
} from "@vercel/geistdocs/pages/docs";
|
|
1377
|
+
import { config } from "./config";
|
|
1378
|
+
import { geistdocsSource } from "./source";
|
|
1379
|
+
|
|
1380
|
+
interface PageParams extends DocsPageParams {
|
|
1381
|
+
audience: string;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
export const docsPage = createDocsPage<PageParams>({
|
|
1385
|
+
config,
|
|
1386
|
+
source: geistdocsSource,
|
|
1387
|
+
canViewPage: (page, { params }) =>
|
|
1388
|
+
page.data.preview !== true || params.audience === "preview",
|
|
1389
|
+
});
|
|
1390
|
+
```
|
|
1391
|
+
|
|
1392
|
+
Use `docsPage.getPageTree(params)` for the layout tree instead of reading the source tree directly:
|
|
1393
|
+
|
|
1394
|
+
```tsx title="app/[lang]/[audience]/docs/layout.tsx"
|
|
1395
|
+
import { DocsLayout } from "@/components/geistdocs/docs-layout";
|
|
1396
|
+
import { docsPage } from "@/lib/geistdocs/docs-page";
|
|
1397
|
+
|
|
1398
|
+
const Layout = async ({
|
|
1399
|
+
children,
|
|
1400
|
+
params,
|
|
1401
|
+
}: LayoutProps<"/[lang]/[audience]/docs">) => (
|
|
1402
|
+
<DocsLayout tree={await docsPage.getPageTree(await params)}>
|
|
1403
|
+
{children}
|
|
1404
|
+
</DocsLayout>
|
|
1405
|
+
);
|
|
1406
|
+
|
|
1407
|
+
export default Layout;
|
|
1408
|
+
```
|
|
1409
|
+
|
|
1410
|
+
`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`:
|
|
1411
|
+
|
|
1412
|
+
```ts title="lib/geistdocs/page-access.ts"
|
|
1413
|
+
export const filterPublicPage = (page: { data: { preview?: boolean } }) =>
|
|
1414
|
+
page.data.preview !== true;
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
Consumers choose the frontmatter field and access provider. Geistdocs does not require a specific authentication or feature flag system.
|
|
1418
|
+
|
|
1354
1419
|
## Last modified dates
|
|
1355
1420
|
|
|
1356
1421
|
`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:
|
|
@@ -1651,6 +1716,32 @@ This renders as:
|
|
|
1651
1716
|
|
|
1652
1717
|
Run independent requests in parallel with [`Promise.all`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
|
|
1653
1718
|
|
|
1719
|
+
#### Force browser-native navigation
|
|
1720
|
+
|
|
1721
|
+
Normal internal links use Next.js navigation, while external links disable
|
|
1722
|
+
prefetching automatically. A custom `createDocsPage` link resolver also
|
|
1723
|
+
receives `nativeLink` for URLs that must always use a regular `<a>`, such as a
|
|
1724
|
+
raw Markdown file or a production URL that should not be localized into a
|
|
1725
|
+
preview deployment. It keeps the same Geistdocs link styling:
|
|
1726
|
+
|
|
1727
|
+
```tsx
|
|
1728
|
+
const docsPage = createDocsPage({
|
|
1729
|
+
config,
|
|
1730
|
+
source,
|
|
1731
|
+
resolveLink: ({ link: Link, nativeLink: NativeLink }) =>
|
|
1732
|
+
function ResolvedLink(props) {
|
|
1733
|
+
const native =
|
|
1734
|
+
props.href?.endsWith(".md") ||
|
|
1735
|
+
props.href?.startsWith("https://example.com");
|
|
1736
|
+
|
|
1737
|
+
return native ? <NativeLink {...props} /> : <Link {...props} />;
|
|
1738
|
+
},
|
|
1739
|
+
});
|
|
1740
|
+
```
|
|
1741
|
+
|
|
1742
|
+
`NativeDocsLink` is also exported from the selected package's
|
|
1743
|
+
`components/link` subpath for use outside `createDocsPage`.
|
|
1744
|
+
|
|
1654
1745
|
### Images
|
|
1655
1746
|
|
|
1656
1747
|
Add images with ``:
|
|
@@ -2593,6 +2684,20 @@ const proxy = createProxy({
|
|
|
2593
2684
|
});
|
|
2594
2685
|
```
|
|
2595
2686
|
|
|
2687
|
+
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.
|
|
2688
|
+
|
|
2689
|
+
```ts title="proxy.ts"
|
|
2690
|
+
const proxy = createProxy({
|
|
2691
|
+
config: geistdocsConfig,
|
|
2692
|
+
transformRewrite: async (pathname, { request }) => {
|
|
2693
|
+
const segment = await resolveRouteSegment(request);
|
|
2694
|
+
return `/${segment}${pathname}`;
|
|
2695
|
+
},
|
|
2696
|
+
});
|
|
2697
|
+
```
|
|
2698
|
+
|
|
2699
|
+
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.
|
|
2700
|
+
|
|
2596
2701
|
## Markdown route mappings
|
|
2597
2702
|
|
|
2598
2703
|
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 +3308,18 @@ The destination route uses `createDocsMarkdownRoute` to process the page and ret
|
|
|
3203
3308
|
|
|
3204
3309
|
```ts title="app/[lang]/llms.mdx/[[...slug]]/route.ts"
|
|
3205
3310
|
import { createDocsMarkdownRoute } from "@vercel/geistdocs/routes/llms";
|
|
3311
|
+
import { filterPublicPage } from "@/lib/geistdocs/page-access";
|
|
3206
3312
|
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
3207
3313
|
|
|
3208
3314
|
export const { GET, generateStaticParams } =
|
|
3209
3315
|
createDocsMarkdownRoute({
|
|
3210
3316
|
sources: [geistdocsSource],
|
|
3317
|
+
canViewPage: filterPublicPage,
|
|
3211
3318
|
});
|
|
3212
3319
|
```
|
|
3213
3320
|
|
|
3321
|
+
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.
|
|
3322
|
+
|
|
3214
3323
|
Read [Proxy and markdown routes](/docs/proxy) to configure additional route families such as `/cookbook` or `/v5/docs`.
|
|
3215
3324
|
|
|
3216
3325
|
## Response Format
|
|
@@ -4398,6 +4507,8 @@ export const { GET } = createLlmsRoute({
|
|
|
4398
4507
|
});
|
|
4399
4508
|
```
|
|
4400
4509
|
|
|
4510
|
+
`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.
|
|
4511
|
+
|
|
4401
4512
|
## The llms.txt standard
|
|
4402
4513
|
|
|
4403
4514
|
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:
|
|
@@ -16,6 +16,14 @@ related:
|
|
|
16
16
|
|
|
17
17
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
18
18
|
|
|
19
|
+
> Note:
|
|
20
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
21
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
22
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
23
|
+
repositories with external contributors, and all other projects must use the
|
|
24
|
+
public `@vercel/geistdocs` package. See
|
|
25
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
26
|
+
|
|
19
27
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
20
28
|
|
|
21
29
|
## Prerequisites
|
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/packages.md
CHANGED
|
@@ -16,7 +16,11 @@ related:
|
|
|
16
16
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
17
17
|
|
|
18
18
|
> Note:
|
|
19
|
-
`@vercel/geistdocs-private`
|
|
19
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
20
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
21
|
+
repositories and projects with external contributors must use
|
|
22
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
23
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
20
24
|
|
|
21
25
|
| Package | Access | UI provider | Recommended use |
|
|
22
26
|
| --- | --- | --- | --- |
|
|
@@ -43,7 +47,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
43
47
|
|
|
44
48
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
45
49
|
|
|
46
|
-
The private
|
|
50
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
47
51
|
|
|
48
52
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
49
53
|
|
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/docs/pages/syntax.md
CHANGED
|
@@ -207,6 +207,32 @@ This renders as:
|
|
|
207
207
|
|
|
208
208
|
Run independent requests in parallel with [`Promise.all`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise/all).
|
|
209
209
|
|
|
210
|
+
#### Force browser-native navigation
|
|
211
|
+
|
|
212
|
+
Normal internal links use Next.js navigation, while external links disable
|
|
213
|
+
prefetching automatically. A custom `createDocsPage` link resolver also
|
|
214
|
+
receives `nativeLink` for URLs that must always use a regular `<a>`, such as a
|
|
215
|
+
raw Markdown file or a production URL that should not be localized into a
|
|
216
|
+
preview deployment. It keeps the same Geistdocs link styling:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
const docsPage = createDocsPage({
|
|
220
|
+
config,
|
|
221
|
+
source,
|
|
222
|
+
resolveLink: ({ link: Link, nativeLink: NativeLink }) =>
|
|
223
|
+
function ResolvedLink(props) {
|
|
224
|
+
const native =
|
|
225
|
+
props.href?.endsWith(".md") ||
|
|
226
|
+
props.href?.startsWith("https://example.com");
|
|
227
|
+
|
|
228
|
+
return native ? <NativeLink {...props} /> : <Link {...props} />;
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
`NativeDocsLink` is also exported from the selected package's
|
|
234
|
+
`components/link` subpath for use outside `createDocsPage`.
|
|
235
|
+
|
|
210
236
|
### Images
|
|
211
237
|
|
|
212
238
|
Add images with ``:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/geistdocs",
|
|
3
3
|
"description": "Runtime and CLI for Geistdocs projects.",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -202,6 +202,10 @@
|
|
|
202
202
|
"types": "./dist/components/image.d.ts",
|
|
203
203
|
"default": "./dist/components/image.js"
|
|
204
204
|
},
|
|
205
|
+
"./components/link": {
|
|
206
|
+
"types": "./dist/components/link.d.ts",
|
|
207
|
+
"default": "./dist/components/link.js"
|
|
208
|
+
},
|
|
205
209
|
"./components/dropdown-menu": {
|
|
206
210
|
"types": "./dist/components/dropdown-menu.d.ts",
|
|
207
211
|
"default": "./dist/components/dropdown-menu.js"
|
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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Provider foundation
|
|
2
|
-
|
|
1
|
+
/* Provider foundation and Geistdocs theme rules are package-owned. The private
|
|
2
|
+
package build adds its consumer-source registration after this import. */
|
|
3
3
|
@import "@vercel/geistdocs/styles.css";
|
|
4
4
|
|
|
5
5
|
:root {
|
|
@@ -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:
|
|
@@ -12,6 +12,15 @@ related:
|
|
|
12
12
|
|
|
13
13
|
Create a new Geistdocs site with the package CLI, then customize its identity, content, and navigation. If you already have a documentation site, use [Migrate to Geistdocs](/docs/migration). Read [Choose a Geistdocs package](/docs/packages) before using the private package.
|
|
14
14
|
|
|
15
|
+
<Callout title="Use Geistdocs Private only for internal, non-OSS apps">
|
|
16
|
+
Use `@vercel/geistdocs-private` only for Vercel-internal applications that
|
|
17
|
+
are not open source and already restrict npm access to authorized Vercel
|
|
18
|
+
users, such as `next-site` or `vercel-docs`. Vercel-owned OSS repositories,
|
|
19
|
+
repositories with external contributors, and all other projects must use the
|
|
20
|
+
public `@vercel/geistdocs` package. See
|
|
21
|
+
[Choose a Geistdocs package](/docs/packages) for the full comparison.
|
|
22
|
+
</Callout>
|
|
23
|
+
|
|
15
24
|
<CopyPrompt text="Create a new Geistdocs project with pnpm dlx @vercel/geistdocs@latest init --name my-docs. Confirm Node.js 20.9 or later, pnpm, and Git are available first. Then run pnpm dev and help me customize geistdocs.tsx, content/docs/index.mdx, and content/docs/meta.json. Keep the generated route, source, UI provider, and Next.js integrations package-backed.">
|
|
16
25
|
Create a new Geistdocs project with `pnpm dlx @vercel/geistdocs@latest init --name my-docs`. Confirm the prerequisites, run `pnpm dev`, and help me customize `geistdocs.tsx`, `content/docs/index.mdx`, and `content/docs/meta.json`. Keep the generated integrations package-backed.
|
|
17
26
|
</CopyPrompt>
|
|
@@ -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
|
|
@@ -14,7 +14,11 @@ related:
|
|
|
14
14
|
Geistdocs ships as two packages built from the same runtime and template. They expose the same API and intentionally share the same visual design, layout, interactions, and product behavior. A site should look and work the same with either package; only the underlying primitive and asset provider differs.
|
|
15
15
|
|
|
16
16
|
<Callout title="Geistdocs Private uses restricted packages">
|
|
17
|
-
`@vercel/geistdocs-private`
|
|
17
|
+
`@vercel/geistdocs-private` uses restricted Geistcn components and assets
|
|
18
|
+
intended only for internal, non-OSS applications. Vercel-owned OSS
|
|
19
|
+
repositories and projects with external contributors must use
|
|
20
|
+
`@vercel/geistdocs`. Do not expose the private package, its dependencies,
|
|
21
|
+
credentials, or downloaded assets outside authorized internal environments.
|
|
18
22
|
</Callout>
|
|
19
23
|
|
|
20
24
|
| Package | Access | UI provider | Recommended use |
|
|
@@ -42,7 +46,7 @@ pnpm dlx @vercel/geistdocs-private@latest init --name my-docs
|
|
|
42
46
|
|
|
43
47
|
The private initializer asks whether the generated template will be used in a public repository. Answer **Yes** to generate the public `@vercel/geistdocs` variant without restricted dependencies. Answer **No** to keep `@vercel/geistdocs-private`.
|
|
44
48
|
|
|
45
|
-
The private
|
|
49
|
+
The generated private template installs `@vercel/geistcn` and `@vercel/geistcn-assets` directly. Both local development and deployment must be authenticated to Vercel's private npm registry. This makes it suitable only for internal environments such as `front`, where that access already exists and remains limited to authorized Vercel users.
|
|
46
50
|
|
|
47
51
|
Do not use the private package in a public repository or provide its registry access to external contributors. Use the public package whenever anyone outside Vercel needs to install, build, or contribute to the project—even if the site itself is deployed on Vercel.
|
|
48
52
|
|
|
@@ -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.
|