@vercel/geistdocs 1.3.1 → 1.4.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.
- package/dist/cli/index.js +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +14 -29
- package/dist/routes/discovery.d.ts +14 -0
- package/dist/routes/discovery.d.ts.map +1 -0
- package/dist/routes/discovery.js +74 -0
- package/dist/routes/mcp.d.ts +26 -0
- package/dist/routes/mcp.d.ts.map +1 -0
- package/dist/routes/mcp.js +31 -0
- package/dist/source.d.ts +1 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +4 -1
- package/docs/agents.md +44 -0
- package/docs/llms.txt +2965 -0
- package/docs/manifest.json +194 -0
- package/docs/pages/agent-readiness.md +141 -0
- package/docs/pages/ask-ai.md +143 -0
- package/docs/pages/configuration.md +278 -0
- package/docs/pages/deployment.md +53 -0
- package/docs/pages/edit-on-github.md +53 -0
- package/docs/pages/env.md +62 -0
- package/docs/pages/feedback.md +91 -0
- package/docs/pages/getting-started.md +116 -0
- package/docs/pages/index.md +99 -0
- package/docs/pages/internationalization.md +124 -0
- package/docs/pages/llms-txt.md +88 -0
- package/docs/pages/md.md +84 -0
- package/docs/pages/migration.md +376 -0
- package/docs/pages/open-in-chat.md +82 -0
- package/docs/pages/provider.md +76 -0
- package/docs/pages/proxy.md +180 -0
- package/docs/pages/rss.md +110 -0
- package/docs/pages/syntax.md +413 -0
- package/docs/pages/theme-aware-image.md +59 -0
- package/docs/pages/versioned-docs.md +230 -0
- package/docs/sitemap.md +25 -0
- package/package.json +12 -2
- package/styles.css +174 -0
- package/template/AGENTS.md +10 -3
- package/template/app/[lang]/.well-known/mcp.json/route.ts +8 -0
- package/template/content/docs/agent-readiness.mdx +44 -8
- package/template/content/docs/configuration.mdx +1 -0
- package/template/content/docs/index.mdx +1 -1
- package/template/content/docs/llms-txt.mdx +1 -1
- package/template/content/docs/migration.mdx +12 -2
- package/template/package.json +1 -1
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migration guide
|
|
3
|
+
description: Migrate a Fumadocs or custom Geist docs site to package-backed Geistdocs
|
|
4
|
+
type: guide
|
|
5
|
+
summary: Move an existing documentation site to @vercel/geistdocs while keeping local content, routing, middleware behavior, and AI-readable surfaces intact.
|
|
6
|
+
url: /docs/migration
|
|
7
|
+
source: apps/template/content/docs/migration.mdx
|
|
8
|
+
prerequisites:
|
|
9
|
+
- /docs/configuration
|
|
10
|
+
- /docs/proxy
|
|
11
|
+
related:
|
|
12
|
+
- /docs/versioned-docs
|
|
13
|
+
- /docs/llms-txt
|
|
14
|
+
- /docs/agent-readiness
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Migration guide
|
|
18
|
+
|
|
19
|
+
Migrate an existing Fumadocs or custom Geist documentation site to `@vercel/geistdocs` by moving shared behavior into package APIs and keeping site-specific adapters local. The safest migration keeps content, routing decisions, and product-specific UI in your app while replacing copied runtime code with thin package-backed adapters.
|
|
20
|
+
|
|
21
|
+
Help me migrate this existing docs site to package-backed Geistdocs. Inspect `source.config.ts`, `lib/geistdocs/source.ts`, app route files, `proxy.ts` or `middleware.ts`, `public/llms.txt`, Open Graph routes, Tailwind CSS setup, `package.json` AI SDK dependencies, and environment variables. Then produce a step-by-step migration plan using `@vercel/geistdocs` package APIs without copying package internals.
|
|
22
|
+
|
|
23
|
+
## Before you migrate
|
|
24
|
+
|
|
25
|
+
Create a working branch and inventory the current site before replacing code:
|
|
26
|
+
|
|
27
|
+
- Existing Fumadocs collections in `source.config.ts`.
|
|
28
|
+
- Public route families, such as `/docs`, `/api-reference`, `/guides`, or `/`.
|
|
29
|
+
- Existing `middleware.ts` or `proxy.ts` behavior.
|
|
30
|
+
- Static files that overlap package routes, such as `public/llms.txt`.
|
|
31
|
+
- Search, chat, `llms.txt`, page-level Markdown, `sitemap.md`, `agents.md`, `/.well-known/mcp.json`, RSS, and Open Graph routes.
|
|
32
|
+
- Tailwind CSS version and custom plugins.
|
|
33
|
+
- Direct app usage of `ai` or `@ai-sdk/react` outside Geistdocs.
|
|
34
|
+
- Environment variables required by the homepage, docs routes, or API routes.
|
|
35
|
+
|
|
36
|
+
Run the current project before changing it:
|
|
37
|
+
|
|
38
|
+
```bash title="Terminal"
|
|
39
|
+
pnpm install
|
|
40
|
+
pnpm build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Fix unrelated build failures first. A migration is safer when the starting point is reproducible.
|
|
44
|
+
|
|
45
|
+
## Install Geistdocs
|
|
46
|
+
|
|
47
|
+
Add `@vercel/geistdocs` and align the supported Fumadocs and Next.js dependencies for the package version you are adopting.
|
|
48
|
+
|
|
49
|
+
For an existing project, use your package manager directly:
|
|
50
|
+
|
|
51
|
+
```bash title="Terminal"
|
|
52
|
+
pnpm add @vercel/geistdocs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If you are starting from a generated Geistdocs project and moving content into it, use the CLI:
|
|
56
|
+
|
|
57
|
+
```bash title="Terminal"
|
|
58
|
+
pnpm dlx @vercel/geistdocs init --name my-docs
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Align Ask AI dependencies
|
|
62
|
+
|
|
63
|
+
Geistdocs Ask AI uses AI SDK v6. Generated projects install `ai` v6 and `@ai-sdk/react` v3 so package-owned chat components and route helpers use the supported AI SDK APIs.
|
|
64
|
+
|
|
65
|
+
If the existing app imports `ai` or `@ai-sdk/react` for product-specific features, migrate that code separately. Keep Geistdocs route adapters package-backed, and do not copy package chat internals into the app to preserve older AI SDK behavior.
|
|
66
|
+
|
|
67
|
+
## Update source config
|
|
68
|
+
|
|
69
|
+
Use the source-config-safe export from `@vercel/geistdocs/source-config` in `source.config.ts`. This file is evaluated by `fumadocs-mdx` during dependency installation and builds, so avoid importing runtime component entry points from it.
|
|
70
|
+
|
|
71
|
+
```ts title="source.config.ts"
|
|
72
|
+
import {
|
|
73
|
+
defineGeistdocsSourceConfig,
|
|
74
|
+
geistdocsFrontmatterSchema,
|
|
75
|
+
geistdocsMetaSchema,
|
|
76
|
+
} from "@vercel/geistdocs/source-config";
|
|
77
|
+
import { defineDocs } from "fumadocs-mdx/config";
|
|
78
|
+
|
|
79
|
+
export const docs = defineDocs({
|
|
80
|
+
dir: "content/docs",
|
|
81
|
+
docs: {
|
|
82
|
+
schema: geistdocsFrontmatterSchema,
|
|
83
|
+
postprocess: {
|
|
84
|
+
includeProcessedMarkdown: true,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
meta: {
|
|
88
|
+
schema: geistdocsMetaSchema,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export default defineGeistdocsSourceConfig();
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For multiple docs families, create one collection per directory and reuse `geistdocsFrontmatterSchema`.
|
|
96
|
+
|
|
97
|
+
## Create the package config
|
|
98
|
+
|
|
99
|
+
Use `@vercel/geistdocs/config` to centralize site metadata and route families in `lib/geistdocs/config.tsx`.
|
|
100
|
+
|
|
101
|
+
```tsx title="lib/geistdocs/config.tsx"
|
|
102
|
+
import { defineConfig } from "@vercel/geistdocs/config";
|
|
103
|
+
import { Logo, github, nav, prompt, suggestions, title } from "@/geistdocs";
|
|
104
|
+
|
|
105
|
+
export const config = defineConfig({
|
|
106
|
+
title,
|
|
107
|
+
defaultLanguage: "en",
|
|
108
|
+
logo: <Logo />,
|
|
109
|
+
github,
|
|
110
|
+
nav,
|
|
111
|
+
content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
|
|
112
|
+
ai: {
|
|
113
|
+
prompt,
|
|
114
|
+
suggestions,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Set `content` to every public documentation route family. `createProxy` uses this metadata to infer standard Markdown mappings for non-root sections.
|
|
120
|
+
|
|
121
|
+
## Connect Fumadocs sources
|
|
122
|
+
|
|
123
|
+
Wrap each Fumadocs collection with `createSource` in `lib/geistdocs/source.ts`.
|
|
124
|
+
|
|
125
|
+
```ts title="lib/geistdocs/source.ts"
|
|
126
|
+
import { createSource } from "@vercel/geistdocs/source";
|
|
127
|
+
import { docs } from "@/.source/server";
|
|
128
|
+
import { config } from "./config";
|
|
129
|
+
|
|
130
|
+
export const geistdocsSource = createSource({
|
|
131
|
+
docs,
|
|
132
|
+
config,
|
|
133
|
+
id: "docs",
|
|
134
|
+
label: "Docs",
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export const source = geistdocsSource.source;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
For root-mounted docs, set `baseUrl: "/"` and use explicit `markdownRoutes` in `proxy.ts`:
|
|
141
|
+
|
|
142
|
+
```ts title="lib/geistdocs/source.ts"
|
|
143
|
+
export const geistdocsSource = createSource({
|
|
144
|
+
docs,
|
|
145
|
+
config,
|
|
146
|
+
baseUrl: "/",
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Add route adapters
|
|
151
|
+
|
|
152
|
+
Keep App Router files thin. Route files should call package helpers instead of copying package internals.
|
|
153
|
+
|
|
154
|
+
```tsx title="app/[lang]/docs/[[...slug]]/page.tsx"
|
|
155
|
+
import { createDocsPage } from "@vercel/geistdocs/pages/docs";
|
|
156
|
+
import { config } from "@/lib/geistdocs/config";
|
|
157
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
158
|
+
|
|
159
|
+
const docsPage = createDocsPage({
|
|
160
|
+
config,
|
|
161
|
+
source: geistdocsSource,
|
|
162
|
+
openGraph: {
|
|
163
|
+
images: true,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
export default docsPage.Page;
|
|
168
|
+
export const generateStaticParams = docsPage.generateStaticParams;
|
|
169
|
+
export const generateMetadata = docsPage.generateMetadata;
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Set `openGraph.images` to `true` only when your app includes the Geistdocs OG route. If you do not add the OG route, omit `openGraph` or override metadata to avoid broken `/og/...` references.
|
|
173
|
+
|
|
174
|
+
## Add AI-readable routes
|
|
175
|
+
|
|
176
|
+
Add the package route helpers for machine-readable docs surfaces.
|
|
177
|
+
|
|
178
|
+
```ts title="app/[lang]/llms.txt/route.ts"
|
|
179
|
+
import { createLlmsRoute } from "@vercel/geistdocs/routes/llms";
|
|
180
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
181
|
+
|
|
182
|
+
export const { GET, revalidate } = createLlmsRoute({
|
|
183
|
+
sources: [geistdocsSource],
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```ts title="app/[lang]/llms.mdx/[[...slug]]/route.ts"
|
|
188
|
+
import { createDocsMarkdownRoute } from "@vercel/geistdocs/routes/llms";
|
|
189
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
190
|
+
|
|
191
|
+
export const { GET, generateStaticParams, revalidate } =
|
|
192
|
+
createDocsMarkdownRoute({
|
|
193
|
+
source: geistdocsSource,
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```ts title="app/[lang]/sitemap.md/route.ts"
|
|
198
|
+
import { createSitemapMarkdownRoute } from "@vercel/geistdocs/routes/sitemap";
|
|
199
|
+
import { config } from "@/lib/geistdocs/config";
|
|
200
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
201
|
+
|
|
202
|
+
export const { GET, generateStaticParams, revalidate, dynamic } =
|
|
203
|
+
createSitemapMarkdownRoute({
|
|
204
|
+
config,
|
|
205
|
+
sources: [{ source: geistdocsSource.source }],
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```ts title="app/[lang]/agents.md/route.ts"
|
|
210
|
+
import { createAgentsRoute } from "@vercel/geistdocs/routes/agents";
|
|
211
|
+
import { config } from "@/lib/geistdocs/config";
|
|
212
|
+
|
|
213
|
+
export const { GET, generateStaticParams, revalidate } = createAgentsRoute({
|
|
214
|
+
config,
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```ts title="app/[lang]/.well-known/mcp.json/route.ts"
|
|
219
|
+
import { createMcpManifestRoute } from "@vercel/geistdocs/routes/mcp";
|
|
220
|
+
import { config } from "@/lib/geistdocs/config";
|
|
221
|
+
|
|
222
|
+
export const { GET, generateStaticParams, revalidate } = createMcpManifestRoute({
|
|
223
|
+
config,
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Delete `public/llms.txt` after adding `createLlmsRoute`. Static files in `public` can mask App Router route behavior.
|
|
228
|
+
|
|
229
|
+
## Add search and Ask AI routes
|
|
230
|
+
|
|
231
|
+
Use package route helpers for search and chat. Keep these files as adapters so `@vercel/geistdocs` can ship AI SDK compatibility fixes.
|
|
232
|
+
|
|
233
|
+
```ts title="app/api/search/route.ts"
|
|
234
|
+
import { createSearchRoute } from "@vercel/geistdocs/routes/search";
|
|
235
|
+
import { config } from "@/lib/geistdocs/config";
|
|
236
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
237
|
+
|
|
238
|
+
export const GET = createSearchRoute({ config, sources: [geistdocsSource] });
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```ts title="app/api/chat/route.ts"
|
|
242
|
+
import { createChatRoute } from "@vercel/geistdocs/routes/chat";
|
|
243
|
+
import { config } from "@/lib/geistdocs/config";
|
|
244
|
+
import { geistdocsSource } from "@/lib/geistdocs/source";
|
|
245
|
+
|
|
246
|
+
const chatProxyUrl = process.env.GEISTDOCS_CHAT_PROXY_URL;
|
|
247
|
+
const chatProxyToken = process.env.GEISTDOCS_CHAT_PROXY_TOKEN;
|
|
248
|
+
|
|
249
|
+
export const { POST, maxDuration } = createChatRoute({
|
|
250
|
+
config,
|
|
251
|
+
proxy: chatProxyUrl
|
|
252
|
+
? {
|
|
253
|
+
url: chatProxyUrl,
|
|
254
|
+
headers: chatProxyToken
|
|
255
|
+
? { Authorization: `Bearer ${chatProxyToken}` }
|
|
256
|
+
: undefined,
|
|
257
|
+
}
|
|
258
|
+
: undefined,
|
|
259
|
+
sources: [geistdocsSource],
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Leave `GEISTDOCS_CHAT_PROXY_URL` unset for default AI Gateway mode. Set it to a `/vertex` proxy URL only when Ask AI should route model requests through the central Vertex-backed service.
|
|
264
|
+
|
|
265
|
+
## Migrate middleware behavior
|
|
266
|
+
|
|
267
|
+
Use `createProxy` in `proxy.ts`. Put existing `middleware.ts` behavior in `before` or `after` hooks instead of replacing Geistdocs markdown negotiation.
|
|
268
|
+
|
|
269
|
+
```ts title="proxy.ts"
|
|
270
|
+
import { createProxy } from "@vercel/geistdocs/proxy";
|
|
271
|
+
import { NextResponse } from "next/server";
|
|
272
|
+
import { config as geistdocsConfig } from "@/lib/geistdocs/config";
|
|
273
|
+
|
|
274
|
+
const proxy = createProxy({
|
|
275
|
+
config: geistdocsConfig,
|
|
276
|
+
before: async ({ request }) => {
|
|
277
|
+
if (request.nextUrl.pathname === "/legacy-docs") {
|
|
278
|
+
return NextResponse.redirect(new URL("/docs", request.url));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return null;
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
export const config = {
|
|
286
|
+
matcher: [
|
|
287
|
+
"/((?!api(?:/|$)|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)",
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
export default proxy;
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Use `api(?:/|$)` in the matcher. A broad `api` exclusion also excludes routes such as `/api-reference`.
|
|
295
|
+
|
|
296
|
+
## Configure Markdown route mappings
|
|
297
|
+
|
|
298
|
+
For standard non-root sections, `createProxy` can infer Markdown routes from `config.content`.
|
|
299
|
+
|
|
300
|
+
Use explicit `markdownRoutes` when the public docs URL does not map directly to the Markdown route handler:
|
|
301
|
+
|
|
302
|
+
```ts title="proxy.ts"
|
|
303
|
+
const proxy = createProxy({
|
|
304
|
+
config: geistdocsConfig,
|
|
305
|
+
markdownRoutes: [
|
|
306
|
+
{ from: "/docs/*path", to: "/[lang]/llms.mdx/*path" },
|
|
307
|
+
{ from: "/api-reference/*path", to: "/[lang]/llms.mdx/api-reference/*path" },
|
|
308
|
+
],
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Root-mounted docs need explicit mappings. If a homepage or app routes also live at `/`, do not use a broad `/*path` mapping. Map each docs family separately:
|
|
313
|
+
|
|
314
|
+
```ts title="proxy.ts"
|
|
315
|
+
const proxy = createProxy({
|
|
316
|
+
config: geistdocsConfig,
|
|
317
|
+
markdownRoutes: [
|
|
318
|
+
{ from: "/guides/*path", to: "/[lang]/llms.mdx/guides/*path" },
|
|
319
|
+
{ from: "/api-reference/*path", to: "/[lang]/llms.mdx/api-reference/*path" },
|
|
320
|
+
],
|
|
321
|
+
});
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Configure Tailwind CSS
|
|
325
|
+
|
|
326
|
+
Tailwind CSS v4 requires `@source` entries for package components and related dependencies.
|
|
327
|
+
|
|
328
|
+
```css title="app/styles/geistdocs.css"
|
|
329
|
+
@import "tailwindcss";
|
|
330
|
+
@import "fumadocs-ui/css/shadcn.css";
|
|
331
|
+
@import "fumadocs-ui/css/preset.css";
|
|
332
|
+
@import "tw-animate-css";
|
|
333
|
+
|
|
334
|
+
@source "../../node_modules/@vercel/geistdocs/dist/**/*.js";
|
|
335
|
+
@source "../../node_modules/streamdown/dist/*.js";
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Move Tailwind CSS v3 plugin utilities into CSS-first v4 utilities or theme variables. Keep custom token names stable while you migrate components.
|
|
339
|
+
|
|
340
|
+
## Handle environment variables
|
|
341
|
+
|
|
342
|
+
Do not require production secrets for local migration builds. If a homepage or API route depends on a production-only secret, add a local fallback or disable that integration in development.
|
|
343
|
+
|
|
344
|
+
```ts title="lib/example-secret.ts"
|
|
345
|
+
export const flagsSecret =
|
|
346
|
+
process.env.FLAGS_SECRET ??
|
|
347
|
+
(process.env.NODE_ENV === "development" ? "local-development-secret" : undefined);
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Keep real secrets in `.env.local` and out of Git.
|
|
351
|
+
|
|
352
|
+
## Verify the migration
|
|
353
|
+
|
|
354
|
+
Run the same checks after each routing or source change:
|
|
355
|
+
|
|
356
|
+
```bash title="Terminal"
|
|
357
|
+
pnpm postinstall
|
|
358
|
+
pnpm build
|
|
359
|
+
pnpm dev
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Check these URLs locally:
|
|
363
|
+
|
|
364
|
+
- `/docs` or the migrated docs root.
|
|
365
|
+
- `/llms.txt`.
|
|
366
|
+
- `/sitemap.md`.
|
|
367
|
+
- `/agents.md`.
|
|
368
|
+
- `/.well-known/mcp.json` if `agent.mcp.servers` is configured.
|
|
369
|
+
- A page-level Markdown URL such as `/docs/getting-started.mdx`.
|
|
370
|
+
- A non-docs route that should not be rewritten as Markdown, such as the homepage.
|
|
371
|
+
|
|
372
|
+
## Next steps
|
|
373
|
+
|
|
374
|
+
- Read [Configuration](/docs/configuration) to review package config options.
|
|
375
|
+
- Read [Proxy and markdown routes](/docs/proxy) to tune request handling.
|
|
376
|
+
- Read [Agent readiness](/docs/agent-readiness) to configure `/agents.md` and `/.well-known/mcp.json` for AI agents.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Open in Chat
|
|
3
|
+
description: Allow users to continue conversations in their preferred AI chat platform with a single click
|
|
4
|
+
type: conceptual
|
|
5
|
+
summary: Transfer documentation context to AI chat platforms like ChatGPT, Claude, Cursor, and v0 with a single click.
|
|
6
|
+
url: /docs/open-in-chat
|
|
7
|
+
source: apps/template/content/docs/open-in-chat.mdx
|
|
8
|
+
related:
|
|
9
|
+
- /docs/ask-ai
|
|
10
|
+
- /docs/env
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Open in Chat
|
|
14
|
+
|
|
15
|
+
The "Open in Chat" feature enables users to seamlessly transfer documentation context to their preferred AI assistant. With a single click, users can open the current page in external AI chat platforms like ChatGPT, Claude, v0, Cursor, and more.
|
|
16
|
+
|
|
17
|
+
Help me test Open in Chat for this Geistdocs site. Verify that page URLs resolve correctly, markdown endpoints work, and each configured AI platform receives useful context.
|
|
18
|
+
|
|
19
|
+
## How it works
|
|
20
|
+
|
|
21
|
+
On every documentation page, users will find an "Open in chat" button in the table of contents sidebar. When clicked, a menu appears with options to open the page in various AI platforms:
|
|
22
|
+
|
|
23
|
+
1. User clicks "Open in chat"
|
|
24
|
+
2. A dropdown menu shows available platforms
|
|
25
|
+
3. User selects their preferred AI assistant
|
|
26
|
+
4. The platform opens with a pre-filled prompt containing the page URL and context
|
|
27
|
+
|
|
28
|
+
The prompt automatically includes:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Read this page, I want to ask questions about it. [URL]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This allows the AI assistant to fetch and understand the page content before answering user questions.
|
|
35
|
+
|
|
36
|
+
## Supported Platforms
|
|
37
|
+
|
|
38
|
+
The feature integrates with multiple popular AI platforms:
|
|
39
|
+
|
|
40
|
+
### Code & Development Tools
|
|
41
|
+
|
|
42
|
+
- **[Cursor](https://cursor.sh/)** - AI-powered code editor
|
|
43
|
+
- **[v0](https://v0.dev/)** - Vercel's AI interface design tool
|
|
44
|
+
|
|
45
|
+
### General AI Assistants
|
|
46
|
+
|
|
47
|
+
- **[ChatGPT](https://chat.openai.com/)** - OpenAI's conversational AI
|
|
48
|
+
- **[Claude](https://claude.ai/)** - Anthropic's AI assistant
|
|
49
|
+
- **[T3](https://t3.gg/)** - T3 Stack AI assistant
|
|
50
|
+
- **[Scira](https://scira.app/)** - AI-powered documentation assistant
|
|
51
|
+
|
|
52
|
+
## Configuration
|
|
53
|
+
|
|
54
|
+
The environment variable `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL` must be set, which you can read more about in the [Environment Variables](/docs/env) section.
|
|
55
|
+
|
|
56
|
+
## User Experience
|
|
57
|
+
|
|
58
|
+
### Desktop Experience
|
|
59
|
+
|
|
60
|
+
The "Open in chat" button appears in the table of contents sidebar with an external link icon. Clicking it reveals a dropdown menu with all available platforms.
|
|
61
|
+
|
|
62
|
+
### Platform-Specific Behavior
|
|
63
|
+
|
|
64
|
+
Each platform has its own integration:
|
|
65
|
+
|
|
66
|
+
- **Browser-based platforms** (ChatGPT, Claude, v0): Open in a new browser tab with the prompt pre-filled
|
|
67
|
+
- **Desktop applications** (Cursor): Open using a custom URL scheme that launches the application
|
|
68
|
+
- **Specialized tools** (T3, Scira): Open with platform-specific parameters and context
|
|
69
|
+
|
|
70
|
+
## Outcomes
|
|
71
|
+
|
|
72
|
+
### For Users
|
|
73
|
+
|
|
74
|
+
1. **Context transfer**: Users do not need to manually copy URLs or switch contexts.
|
|
75
|
+
2. **Consistent starting point**: Each AI platform receives the same page context.
|
|
76
|
+
3. **Tool choice**: Users can open the AI platform they prefer.
|
|
77
|
+
|
|
78
|
+
### For Documentation Authors
|
|
79
|
+
|
|
80
|
+
1. **More support paths**: Users can ask follow-up questions about a page.
|
|
81
|
+
2. **Lower support load**: AI assistants can answer common documentation questions.
|
|
82
|
+
3. **Platform flexibility**: Teams can support different AI preferences.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Geistdocs Provider
|
|
3
|
+
description: The root provider component that handles notifications, search and analytics
|
|
4
|
+
type: reference
|
|
5
|
+
summary: The root provider component that wraps your application to handle toast notifications, search, and analytics.
|
|
6
|
+
url: /docs/provider
|
|
7
|
+
source: apps/template/content/docs/provider.mdx
|
|
8
|
+
prerequisites:
|
|
9
|
+
- /docs/getting-started
|
|
10
|
+
related:
|
|
11
|
+
- /docs/configuration
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Geistdocs Provider
|
|
15
|
+
|
|
16
|
+
The `GeistdocsProvider` wraps the root of your application with package-managed UI state. It connects theme, search, AI chat, notifications, and optional analytics to the rest of your Geistdocs site.
|
|
17
|
+
|
|
18
|
+
Review my Geistdocs provider setup. Check that the root layout wraps the app with `GeistdocsProvider`, that config is passed correctly, and that analytics, search, theme, and Ask AI behavior are wired safely.
|
|
19
|
+
|
|
20
|
+
## What it does
|
|
21
|
+
|
|
22
|
+
The provider handles these behaviors:
|
|
23
|
+
|
|
24
|
+
1. **Toast notifications**: Provides a global notification system for user feedback.
|
|
25
|
+
2. **Analytics**: Integrates Vercel Analytics and Speed Insights when the local adapter includes them.
|
|
26
|
+
3. **Search**: Configures the search dialog and connects it to your search API.
|
|
27
|
+
4. **Ask AI**: Provides the client state used by the chat sidebar and page actions.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
Ensure your application is wrapped with the provider in your root layout:
|
|
32
|
+
|
|
33
|
+
```tsx title="app/layout.tsx"
|
|
34
|
+
import { GeistdocsProvider } from "@/components/geistdocs/provider";
|
|
35
|
+
|
|
36
|
+
const Layout = ({ children }: LayoutProps) => (
|
|
37
|
+
<html lang="en">
|
|
38
|
+
<body>
|
|
39
|
+
<GeistdocsProvider>
|
|
40
|
+
<Navbar />
|
|
41
|
+
{children}
|
|
42
|
+
</GeistdocsProvider>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The generated local adapter imports the package provider and passes your site config to it.
|
|
49
|
+
|
|
50
|
+
## AI Sidebar
|
|
51
|
+
|
|
52
|
+
When users open the AI chat on desktop, the provider automatically adds padding to prevent content from being hidden behind the sidebar. On mobile, the chat opens as a drawer instead, so no padding is needed.
|
|
53
|
+
|
|
54
|
+
The provider detects the screen size and chat state.
|
|
55
|
+
|
|
56
|
+
## Toast Notifications
|
|
57
|
+
|
|
58
|
+
The provider includes a global toast notification system. Use it anywhere in your app:
|
|
59
|
+
|
|
60
|
+
```tsx title="page.tsx"
|
|
61
|
+
import { toast } from "sonner";
|
|
62
|
+
|
|
63
|
+
toast.success("Changes saved");
|
|
64
|
+
toast.error("Something went wrong");
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Analytics
|
|
68
|
+
|
|
69
|
+
Vercel Analytics is automatically included and tracks:
|
|
70
|
+
|
|
71
|
+
- Page views
|
|
72
|
+
- Web Vitals
|
|
73
|
+
- User interactions
|
|
74
|
+
- Performance metrics
|
|
75
|
+
|
|
76
|
+
No configuration needed - it works automatically when deployed on Vercel.
|