@vercel/geistdocs 1.22.0 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +2 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/footer.d.ts.map +1 -1
  5. package/dist/footer.js +5 -0
  6. package/dist/home-layout.d.ts +2 -2
  7. package/dist/home-layout.d.ts.map +1 -1
  8. package/dist/home-layout.js +52 -18
  9. package/dist/internal/localized-link.js +1 -1
  10. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
  11. package/dist/internal/navbar/navbar-logo.js +27 -7
  12. package/dist/internal/page-actions-client.d.ts.map +1 -1
  13. package/dist/internal/page-actions-client.js +18 -2
  14. package/dist/internal/ui/navigation-menu.d.ts +1 -1
  15. package/dist/internal/ui/navigation-menu.d.ts.map +1 -1
  16. package/dist/internal/ui/navigation-menu.js +2 -9
  17. package/dist/localize-href.d.ts +6 -0
  18. package/dist/localize-href.d.ts.map +1 -0
  19. package/dist/{internal/localize-href.js → localize-href.js} +2 -5
  20. package/dist/{internal/page-visibility.d.ts → page-visibility.d.ts} +1 -1
  21. package/dist/page-visibility.d.ts.map +1 -0
  22. package/dist/pages/docs.d.ts +2 -2
  23. package/dist/pages/docs.d.ts.map +1 -1
  24. package/dist/pages/docs.js +10 -5
  25. package/dist/proxy.d.ts +1 -1
  26. package/dist/proxy.d.ts.map +1 -1
  27. package/dist/proxy.js +13 -2
  28. package/dist/routes/agents.d.ts.map +1 -1
  29. package/dist/routes/agents.js +4 -4
  30. package/dist/routes/chat.js +1 -1
  31. package/dist/routes/llms.js +1 -1
  32. package/dist/routes/not-found.d.ts +14 -0
  33. package/dist/routes/not-found.d.ts.map +1 -0
  34. package/dist/routes/not-found.js +74 -0
  35. package/dist/routes/search.js +1 -1
  36. package/dist/routes/sitemap.d.ts +1 -1
  37. package/dist/routes/sitemap.d.ts.map +1 -1
  38. package/dist/routes/sitemap.js +1 -1
  39. package/docs/agents.md +1 -1
  40. package/docs/llms.txt +8 -4
  41. package/docs/manifest.json +1 -1
  42. package/docs/pages/agent-readiness.md +1 -1
  43. package/docs/pages/env.md +2 -2
  44. package/docs/pages/md.md +2 -0
  45. package/docs/pages/proxy.md +2 -0
  46. package/package.json +13 -1
  47. package/template/app/[lang]/(home)/components/centered-section.tsx +9 -1
  48. package/template/app/[lang]/(home)/components/text-grid-section.tsx +39 -10
  49. package/template/app/[lang]/(home)/opengraph-image.tsx +40 -0
  50. package/template/app/[lang]/(home)/page.tsx +145 -89
  51. package/template/app/[lang]/[...not-found]/route.ts +4 -0
  52. package/template/app/[lang]/layout.tsx +7 -0
  53. package/template/app/[lang]/not-found.tsx +37 -0
  54. package/template/app/[lang]/rss.xml/route.ts +3 -4
  55. package/template/app/robots.ts +4 -4
  56. package/template/app/sitemap.ts +11 -8
  57. package/template/content/docs/agent-readiness.mdx +1 -1
  58. package/template/content/docs/env.mdx +2 -2
  59. package/template/content/docs/md.mdx +2 -0
  60. package/template/content/docs/proxy.mdx +2 -0
  61. package/template/lib/geistdocs/config.tsx +2 -0
  62. package/template/lib/geistdocs/public-path.ts +14 -0
  63. package/template/lib/geistdocs/site-url-warning.ts +10 -0
  64. package/template/lib/geistdocs/site-url.ts +33 -0
  65. package/template/next.config.ts +0 -10
  66. package/template/package.json +1 -1
  67. package/dist/internal/localize-href.d.ts +0 -9
  68. package/dist/internal/localize-href.d.ts.map +0 -1
  69. package/dist/internal/page-visibility.d.ts.map +0 -1
  70. package/template/app/[lang]/(home)/components/templates.tsx +0 -48
  71. /package/dist/{internal/page-visibility.js → page-visibility.js} +0 -0
@@ -9,123 +9,179 @@ import {
9
9
  CommandPromptTriggerDivider,
10
10
  CommandPromptViewport,
11
11
  } from "@vercel/geistdocs/components/command-prompt";
12
+ import type { GeistdocsAgentReadinessConfig } from "@vercel/geistdocs/config";
12
13
  import type { Metadata } from "next";
14
+ import { config } from "@/lib/geistdocs/config";
15
+ import { getLocalizedPath } from "@/lib/geistdocs/public-path";
13
16
  import { CenteredSection } from "./components/centered-section";
14
17
  import { CTA } from "./components/cta";
15
18
  import { Hero } from "./components/hero";
16
19
  import { OneTwoSection } from "./components/one-two-section";
17
- import { Templates } from "./components/templates";
18
20
  import { TextGridSection } from "./components/text-grid-section";
19
21
 
20
22
  const title = "Geistdocs";
21
23
  const description =
22
24
  "A Vercel documentation template built with Next.js and Fumadocs. Designed for spinning up documentation sites quickly and consistently.";
23
25
 
24
- export const metadata: Metadata = {
25
- title,
26
- description,
27
- };
26
+ export const generateMetadata = async ({
27
+ params,
28
+ }: PageProps<"/[lang]">): Promise<Metadata> => {
29
+ const { lang } = await params;
30
+ const agentConfig = config.agent as GeistdocsAgentReadinessConfig | undefined;
28
31
 
29
- const templates = [
30
- {
31
- title: "Template 1",
32
- description: "Description of template 1",
33
- link: "https://example.com/template-1",
34
- image: "https://placehold.co/600x400.png",
35
- },
36
- {
37
- title: "Template 2",
38
- description: "Description of template 2",
39
- link: "https://example.com/template-2",
40
- image: "https://placehold.co/600x400.png",
41
- },
42
- {
43
- title: "Template 3",
44
- description: "Description of template 3",
45
- link: "https://example.com/template-3",
46
- image: "https://placehold.co/600x400.png",
47
- },
48
- ];
32
+ return {
33
+ title,
34
+ description,
35
+ alternates: {
36
+ ...(config.siteUrl
37
+ ? {
38
+ canonical: getLocalizedPath(lang, "/"),
39
+ ...(agentConfig && agentConfig.enabled !== false
40
+ ? {
41
+ types: {
42
+ "text/markdown": getLocalizedPath(lang, "/agents.md"),
43
+ },
44
+ }
45
+ : {}),
46
+ }
47
+ : {}),
48
+ },
49
+ openGraph: {
50
+ title,
51
+ description,
52
+ type: "website",
53
+ ...(config.siteUrl ? { url: getLocalizedPath(lang, "/") } : {}),
54
+ },
55
+ };
56
+ };
49
57
 
50
58
  const textGridSection = [
51
59
  {
52
- id: "1",
53
- title: "Text Grid Section",
54
- description: "Description of text grid section",
60
+ id: "runtime",
61
+ title: "Package-backed runtime",
62
+ description:
63
+ "Share navigation, search, Ask AI, page actions, and rendering behavior through one versioned package.",
55
64
  },
56
65
  {
57
- id: "2",
58
- title: "Text Grid Section",
59
- description: "Description of text grid section",
66
+ id: "content",
67
+ title: "Project-owned content",
68
+ description:
69
+ "Keep documentation, configuration, and thin adapters in the product repository where teams already work.",
60
70
  },
61
71
  {
62
- id: "3",
63
- title: "Text Grid Section",
64
- description: "Description of text grid section",
72
+ id: "agents",
73
+ title: "Agent-readable by default",
74
+ description:
75
+ "Publish llms.txt, agents.md, a semantic sitemap, and focused Markdown versions of documentation pages.",
65
76
  },
66
77
  {
67
- id: "4",
68
- title: "Text Grid Section",
69
- description: "Description of text grid section",
78
+ id: "shapes",
79
+ title: "Flexible site shapes",
80
+ description:
81
+ "Support localized, versioned, multi-section, base-path, and root-mounted documentation without forking the runtime.",
70
82
  },
71
83
  ];
72
84
 
73
85
  const COMMAND_FOR_HUMANS = "npx @vercel/geistdocs init";
74
86
  const COMMAND_FOR_AGENTS = "npx @vercel/geistdocs init --agent";
75
87
 
76
- const HomePage = () => (
77
- <div className="mx-auto w-full max-w-[1448px] px-4 sm:px-6">
78
- <Hero
79
- badge="Geistdocs is now in beta"
80
- description={description}
81
- title={title}
82
- >
83
- <CommandPromptRoot defaultValue="humans">
84
- <CommandPromptList>
85
- <CommandPromptTrigger className="min-w-[90px]" value="humans">
86
- For humans
87
- </CommandPromptTrigger>
88
- <CommandPromptTriggerDivider />
89
- <CommandPromptTrigger className="min-w-[84px]" value="agents">
90
- For agents
91
- </CommandPromptTrigger>
92
- </CommandPromptList>
93
- <CommandPromptSurface>
94
- <CommandPromptPrefix>$</CommandPromptPrefix>
95
- <CommandPromptViewport>
96
- <CommandPromptContent copyValue={COMMAND_FOR_HUMANS} value="humans">
97
- {COMMAND_FOR_HUMANS}
98
- </CommandPromptContent>
99
- <CommandPromptContent copyValue={COMMAND_FOR_AGENTS} value="agents">
100
- {COMMAND_FOR_AGENTS}
101
- </CommandPromptContent>
102
- </CommandPromptViewport>
103
- <CommandPromptCopy />
104
- </CommandPromptSurface>
105
- </CommandPromptRoot>
106
- </Hero>
107
- <div className="flex flex-col">
108
- <TextGridSection data={textGridSection} />
109
- <CenteredSection
110
- description="Description of centered section"
111
- title="Centered Section"
112
- >
113
- <div className="aspect-video rounded-lg border bg-background-100" />
114
- </CenteredSection>
115
- <OneTwoSection
116
- description="Description of one/two section"
117
- title="One/Two Section"
88
+ const HomePage = async ({ params }: PageProps<"/[lang]">) => {
89
+ const { lang } = await params;
90
+
91
+ return (
92
+ <div className="mx-auto w-full max-w-[1448px] px-4 sm:px-6">
93
+ <Hero
94
+ badge="Geistdocs is now in beta"
95
+ description={description}
96
+ title={title}
118
97
  >
119
- <div className="aspect-video rounded-lg border bg-background-100" />
120
- </OneTwoSection>
121
- <Templates
122
- data={templates}
123
- description="See Geistdocs in action with one of our templates."
124
- title="Get started quickly"
125
- />
126
- <CTA cta="Get started" href="/docs" title="Start your docs today" />
98
+ <CommandPromptRoot defaultValue="humans">
99
+ <CommandPromptList>
100
+ <CommandPromptTrigger className="min-w-[90px]" value="humans">
101
+ For humans
102
+ </CommandPromptTrigger>
103
+ <CommandPromptTriggerDivider />
104
+ <CommandPromptTrigger className="min-w-[84px]" value="agents">
105
+ For agents
106
+ </CommandPromptTrigger>
107
+ </CommandPromptList>
108
+ <CommandPromptSurface>
109
+ <CommandPromptPrefix>$</CommandPromptPrefix>
110
+ <CommandPromptViewport>
111
+ <CommandPromptContent
112
+ copyValue={COMMAND_FOR_HUMANS}
113
+ value="humans"
114
+ >
115
+ {COMMAND_FOR_HUMANS}
116
+ </CommandPromptContent>
117
+ <CommandPromptContent
118
+ copyValue={COMMAND_FOR_AGENTS}
119
+ value="agents"
120
+ >
121
+ {COMMAND_FOR_AGENTS}
122
+ </CommandPromptContent>
123
+ </CommandPromptViewport>
124
+ <CommandPromptCopy />
125
+ </CommandPromptSurface>
126
+ </CommandPromptRoot>
127
+ </Hero>
128
+ <div className="flex flex-col">
129
+ <TextGridSection
130
+ className="@min-[640px]:mt-16 mt-12"
131
+ data={textGridSection}
132
+ description="Geistdocs combines a shared runtime with local ownership, so documentation teams can standardize behavior without centralizing every page."
133
+ title="A complete foundation for product documentation"
134
+ />
135
+ <CenteredSection
136
+ align="left"
137
+ description="Every generated project starts as a normal Next.js application. Write MDX locally, configure the shared shell, and deploy with the same workflow as the product it documents."
138
+ title="Keep documentation close to the product"
139
+ >
140
+ <div className="grid gap-3 rounded-lg border bg-background-100 p-6 font-mono text-sm">
141
+ <p>content/docs/ stores the documentation source.</p>
142
+ <p>geistdocs.tsx defines product and agent metadata.</p>
143
+ <p>@vercel/geistdocs provides the shared runtime.</p>
144
+ </div>
145
+ </CenteredSection>
146
+ <OneTwoSection
147
+ description="Agents can discover the documentation corpus, choose a focused page, and recover from stale links without parsing the interactive application shell."
148
+ title="Give agents a direct path through the docs"
149
+ >
150
+ <ul className="grid gap-4 rounded-lg border bg-background-100 p-6 text-gray-900">
151
+ <li>
152
+ <a
153
+ className="underline"
154
+ href={getLocalizedPath(lang, "/agents.md")}
155
+ >
156
+ /agents.md
157
+ </a>{" "}
158
+ explains when to use the product and where to find authoritative
159
+ context.
160
+ </li>
161
+ <li>
162
+ <a
163
+ className="underline"
164
+ href={getLocalizedPath(lang, "/sitemap.md")}
165
+ >
166
+ /sitemap.md
167
+ </a>{" "}
168
+ maps documentation pages by purpose, summary, and prerequisites.
169
+ </li>
170
+ <li>
171
+ <a
172
+ className="underline"
173
+ href={getLocalizedPath(lang, "/llms.txt")}
174
+ >
175
+ /llms.txt
176
+ </a>{" "}
177
+ provides the complete documentation corpus as Markdown.
178
+ </li>
179
+ </ul>
180
+ </OneTwoSection>
181
+ <CTA cta="Get started" href="/docs" title="Start your docs today" />
182
+ </div>
127
183
  </div>
128
- </div>
129
- );
184
+ );
185
+ };
130
186
 
131
187
  export default HomePage;
@@ -0,0 +1,4 @@
1
+ import { createNotFoundRoute } from "@vercel/geistdocs/routes/not-found";
2
+ import { config } from "@/lib/geistdocs/config";
3
+
4
+ export const { GET } = createNotFoundRoute({ config });
@@ -1,16 +1,23 @@
1
1
  import "../global.css";
2
+ import "@/lib/geistdocs/site-url-warning";
2
3
  import { Footer } from "@vercel/geistdocs/footer";
3
4
  import { Navbar } from "@vercel/geistdocs/navbar";
5
+ import type { Metadata } from "next";
4
6
  import { GeistdocsProvider } from "@/components/geistdocs/provider";
5
7
  import { config } from "@/lib/geistdocs/config";
6
8
  import { mono, sans } from "@/lib/geistdocs/fonts";
7
9
  import { i18n } from "@/lib/geistdocs/i18n";
8
10
  import { getRootLang } from "@/lib/geistdocs/root-params";
11
+ import { isSiteUrlConfigured, siteUrl } from "@/lib/geistdocs/site-url";
9
12
  import { cn } from "@/lib/utils";
10
13
 
11
14
  export const generateStaticParams = () =>
12
15
  i18n.languages.map((lang) => ({ lang }));
13
16
 
17
+ export const metadata: Metadata = {
18
+ metadataBase: isSiteUrlConfigured ? siteUrl : undefined,
19
+ };
20
+
14
21
  const Layout = async ({ children }: LayoutProps<"/[lang]">) => {
15
22
  const lang = await getRootLang();
16
23
 
@@ -0,0 +1,37 @@
1
+ import { lang } from "next/root-params";
2
+ import { getLocalizedPath } from "@/lib/geistdocs/public-path";
3
+
4
+ const NotFound = async () => {
5
+ const currentLang = await lang();
6
+ const path = (value: string) => getLocalizedPath(currentLang, value);
7
+
8
+ return (
9
+ <main className="mx-auto grid min-h-[60vh] w-full max-w-2xl content-center gap-5 px-6 py-20">
10
+ <p className="font-mono text-gray-900 text-sm">404</p>
11
+ <h1 className="font-[450] text-4xl tracking-tight">Page not found</h1>
12
+ <p className="text-gray-900 text-lg">
13
+ The requested page does not exist. Browse the documentation or use a
14
+ machine-readable index to find the closest current page.
15
+ </p>
16
+ <ul className="grid gap-2">
17
+ <li>
18
+ <a className="underline" href={path("/docs")}>
19
+ Browse the documentation
20
+ </a>
21
+ </li>
22
+ <li>
23
+ <a className="underline" href={path("/sitemap.md")}>
24
+ Open the semantic sitemap
25
+ </a>
26
+ </li>
27
+ <li>
28
+ <a className="underline" href={path("/llms.txt")}>
29
+ Open the complete Markdown corpus
30
+ </a>
31
+ </li>
32
+ </ul>
33
+ </main>
34
+ );
35
+ };
36
+
37
+ export default NotFound;
@@ -4,12 +4,11 @@ import { cacheLife } from "next/cache";
4
4
  import type { NextRequest } from "next/server";
5
5
  import { title } from "@/geistdocs";
6
6
  import { config } from "@/lib/geistdocs/config";
7
+ import { absoluteUrl } from "@/lib/geistdocs/site-url";
7
8
  import { source } from "@/lib/geistdocs/source";
8
9
 
9
- const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
10
- const baseUrl = `${protocol}://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
11
10
  const sitePath = getPublicPath("/", config.basePath);
12
- const siteUrl = sitePath === "/" ? baseUrl : `${baseUrl}${sitePath}`;
11
+ const siteUrl = absoluteUrl(sitePath);
13
12
 
14
13
  // biome-ignore lint/suspicious/useAwait: Next.js requires cached functions to be async.
15
14
  const getFeed = async (lang: string) => {
@@ -35,7 +34,7 @@ const getFeed = async (lang: string) => {
35
34
  id: page.url,
36
35
  title: data.title ?? page.url,
37
36
  description: data.description,
38
- link: `${baseUrl}${getPublicPath(page.url, config.basePath)}`,
37
+ link: absoluteUrl(getPublicPath(page.url, config.basePath)),
39
38
  date: new Date(data.lastModified ?? new Date()),
40
39
  author: [
41
40
  {
@@ -1,7 +1,7 @@
1
+ import { getPublicPath } from "@vercel/geistdocs/config";
1
2
  import type { MetadataRoute } from "next";
2
-
3
- const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
4
- const baseUrl = `${protocol}://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
3
+ import { config } from "@/lib/geistdocs/config";
4
+ import { absoluteUrl } from "@/lib/geistdocs/site-url";
5
5
 
6
6
  export default function robots(): MetadataRoute.Robots {
7
7
  return {
@@ -9,6 +9,6 @@ export default function robots(): MetadataRoute.Robots {
9
9
  userAgent: "*",
10
10
  allow: "/",
11
11
  },
12
- sitemap: `${baseUrl}/sitemap.xml`,
12
+ sitemap: absoluteUrl(getPublicPath("/sitemap.xml", config.basePath)),
13
13
  };
14
14
  }
@@ -1,24 +1,27 @@
1
+ import { getPublicPath } from "@vercel/geistdocs/config";
2
+ import { isPageVisibleForSurface } from "@vercel/geistdocs/page-visibility";
1
3
  import type { MetadataRoute } from "next";
2
4
  import { cacheLife } from "next/cache";
3
-
5
+ import { config } from "@/lib/geistdocs/config";
6
+ import { absoluteUrl } from "@/lib/geistdocs/site-url";
4
7
  import { source } from "@/lib/geistdocs/source";
5
8
 
6
- const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
7
- const baseUrl = `${protocol}://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
8
-
9
9
  // biome-ignore lint/suspicious/useAwait: Next.js requires cached functions to be async.
10
10
  export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
11
11
  "use cache";
12
12
  cacheLife("max");
13
13
 
14
- const url = (path: string): string => new URL(path, baseUrl).toString();
14
+ const url = (path: string) =>
15
+ absoluteUrl(getPublicPath(path, config.basePath));
15
16
 
16
17
  const pages: MetadataRoute.Sitemap = [];
17
18
 
18
19
  for (const page of source.getPages()) {
19
- const data = page.data as {
20
- lastModified?: Date;
21
- };
20
+ if (!isPageVisibleForSurface(page, "sitemap")) {
21
+ continue;
22
+ }
23
+
24
+ const data = page.data as { lastModified?: Date };
22
25
 
23
26
  pages.push({
24
27
  changeFrequency: "weekly" as const,
@@ -17,7 +17,7 @@ Geistdocs can generate `/agents.md` and `/.well-known/mcp.json` discovery files
17
17
 
18
18
  ## What it provides
19
19
 
20
- The generated `/agents.md` file gives agents a stable starting point before they crawl the rest of your documentation. The optional `/.well-known/mcp.json` route advertises configured MCP servers without running an MCP server inside Geistdocs.
20
+ The generated `/agents.md` file gives agents a stable starting point before they crawl the rest of your documentation. Its product section states when to use the documented product, and the homepage serves the same guidance when an agent requests `text/markdown`. The optional `/.well-known/mcp.json` route advertises configured MCP servers without running an MCP server inside Geistdocs.
21
21
 
22
22
  It can include:
23
23
 
@@ -55,6 +55,6 @@ The Vertex deployment does not need a Geistdocs-specific environment variable. A
55
55
 
56
56
  ## `NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL`
57
57
 
58
- The production URL of the Geistdocs site. This is automatically set when deploying to Vercel.
58
+ The production URL of the Geistdocs site. Geistdocs uses it for canonical and Open Graph metadata, product JSON-LD, `sitemap.xml`, `robots.txt`, and RSS links. Vercel sets this variable automatically.
59
59
 
60
- It should be in the format `localhost:3000` (i.e. without the protocol prefix). This is how Vercel sets the environment variable when deploying to a project.
60
+ Set this variable explicitly when deploying outside Vercel. Use a hostname such as `docs.example.com` or a full `http` or `https` URL. Local development falls back to `http://localhost:3000`. A production build with a missing or malformed value emits a warning and omits default canonical and product JSON-LD URLs. Its `sitemap.xml`, `robots.txt` sitemap directive, RSS links, and generated Open Graph image URLs continue to use the localhost fallback, so treat the warning as a deployment blocker. Geistdocs does not use the deployment-specific `VERCEL_URL` for canonical surfaces.
@@ -93,6 +93,8 @@ When a Markdown request does not match a page, Geistdocs returns an agent-readab
93
93
 
94
94
  For example, a request for `/docs/env-vars` can suggest `/docs/environment-variables.md`. The response uses a short cache lifetime and returns a real `404` status. It also sends `X-Robots-Tag: noindex` and no canonical link because the requested page does not exist. Regular HTML requests keep the app's standard not-found behavior.
95
95
 
96
+ Generated projects also include a catch-all route for unknown application paths outside configured documentation sections. It returns a concise Markdown 404 with links to the docs, `sitemap.md`, and `llms.txt` for agent or `Accept: text/markdown` requests. Browser requests receive the same recovery links as HTML.
97
+
96
98
  Enable this behavior with `notFound: {}`. Pass `notFound: { status: 410 }` for permanently removed pages. Legacy `status: 200` values are treated as `404` so missing pages always return a real error status. Without `notFound`, Markdown requests use the standard Next.js not-found response.
97
99
 
98
100
  If a custom `markdownRoutes` mapping changes the public path shape, set `notFound.getRequestedPath` to reconstruct the app-local public pathname. This also keeps page lookup and suggestions within the right source when a flattened route serves multiple sources:
@@ -87,6 +87,8 @@ const proxy = createProxy({
87
87
 
88
88
  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.
89
89
 
90
+ When `agent` metadata is configured, a request to the homepage with `Accept: text/markdown` returns the generated `/agents.md` content. This gives agents a product overview and focused discovery links without treating every application route as documentation.
91
+
90
92
  Geistdocs does not infer Markdown mappings for `content` sections with `route: "/"`. A root catch-all such as `/*path` can make a homepage or other application routes look like documentation. Use explicit `markdownRoutes` for root-mounted docs.
91
93
 
92
94
  ```tsx title="lib/geistdocs/config.tsx"
@@ -11,6 +11,7 @@ import {
11
11
  title,
12
12
  translations,
13
13
  } from "@/geistdocs";
14
+ import { isSiteUrlConfigured, siteUrl } from "./site-url";
14
15
 
15
16
  export const config = defineConfig({
16
17
  title,
@@ -21,6 +22,7 @@ export const config = defineConfig({
21
22
  nav,
22
23
  basePath,
23
24
  siteId,
25
+ siteUrl: isSiteUrlConfigured ? siteUrl.toString() : undefined,
24
26
  translations,
25
27
  content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
26
28
  ai: {
@@ -0,0 +1,14 @@
1
+ import { getPublicPath } from "@vercel/geistdocs/config";
2
+ import { localizeHref } from "@vercel/geistdocs/localize-href";
3
+ import { config } from "./config";
4
+
5
+ export const getLocalizedPath = (lang: string | undefined, path: string) => {
6
+ const defaultLanguage = config.defaultLanguage ?? "en";
7
+ const localizedPath = localizeHref(
8
+ path,
9
+ lang ?? defaultLanguage,
10
+ defaultLanguage
11
+ );
12
+
13
+ return getPublicPath(localizedPath, config.basePath);
14
+ };
@@ -0,0 +1,10 @@
1
+ import { siteUrlIssue } from "./site-url";
2
+
3
+ if (siteUrlIssue && process.env.NODE_ENV === "production") {
4
+ process.emitWarning(
5
+ `${siteUrlIssue}. Absolute site URLs will use http://localhost:3000.`,
6
+ {
7
+ code: "GEISTDOCS_SITE_URL_FALLBACK",
8
+ }
9
+ );
10
+ }
@@ -0,0 +1,33 @@
1
+ const configuredUrl = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL;
2
+ const fallbackSiteUrl = new URL("http://localhost:3000");
3
+
4
+ const resolveSiteUrl = () => {
5
+ if (!configuredUrl) {
6
+ return {
7
+ issue: "NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL is not set",
8
+ url: fallbackSiteUrl,
9
+ };
10
+ }
11
+
12
+ const value =
13
+ configuredUrl.startsWith("http://") || configuredUrl.startsWith("https://")
14
+ ? configuredUrl
15
+ : `https://${configuredUrl}`;
16
+
17
+ try {
18
+ return { issue: undefined, url: new URL(value) };
19
+ } catch {
20
+ return {
21
+ issue: "NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL is invalid",
22
+ url: fallbackSiteUrl,
23
+ };
24
+ }
25
+ };
26
+
27
+ const resolvedSiteUrl = resolveSiteUrl();
28
+
29
+ export const isSiteUrlConfigured = !resolvedSiteUrl.issue;
30
+ export const siteUrlIssue = resolvedSiteUrl.issue;
31
+ export const siteUrl = resolvedSiteUrl.url;
32
+
33
+ export const absoluteUrl = (path: string) => new URL(path, siteUrl).toString();
@@ -28,16 +28,6 @@ const config: NextConfig = {
28
28
  cacheComponents: true,
29
29
  partialPrefetching: true,
30
30
 
31
- images: {
32
- formats: ["image/avif", "image/webp"],
33
- remotePatterns: [
34
- {
35
- protocol: "https",
36
- hostname: "placehold.co",
37
- },
38
- ],
39
- },
40
-
41
31
  rewrites() {
42
32
  if (!envFavicon) {
43
33
  return Promise.resolve([]);
@@ -18,7 +18,7 @@
18
18
  "@streamdown/code": "^1.0.1",
19
19
  "@vercel/agent-readability": "^0.6.0",
20
20
  "@vercel/analytics": "^1.6.1",
21
- "@vercel/geistdocs": "1.22.0",
21
+ "@vercel/geistdocs": "1.23.1",
22
22
  "@vercel/speed-insights": "^1.3.1",
23
23
  "ai": "^6.0.132",
24
24
  "class-variance-authority": "^0.7.1",
@@ -1,9 +0,0 @@
1
- /**
2
- * Prefix an app-local href with the active non-default language, so links
3
- * keep visitors in their locale (`/docs` -> `/cn/docs` on `/cn/...` pages).
4
- * External and protocol-relative hrefs pass through unchanged.
5
- *
6
- * Dependency-free so it can be unit-tested outside a React render.
7
- */
8
- export declare const localizeHref: (href: string, language: string | undefined, defaultLanguage: string) => string;
9
- //# sourceMappingURL=localize-href.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localize-href.d.ts","sourceRoot":"","sources":["../../src/internal/localize-href.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,UAAU,MAAM,GAAG,SAAS,EAC5B,iBAAiB,MAAM,KACtB,MAWF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"page-visibility.d.ts","sourceRoot":"","sources":["../../src/internal/page-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,6BAA6B;IACrC,IAAI,EAAE,OAAO,CAAC;CACf;AAKD,eAAO,MAAM,eAAe,GAAI,MAAM,6BAA6B,YAGlE,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,MAAM,6BAA6B,EACnC,SAAS,oBAAoB,YAa9B,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,MAAM,6BAA6B,KAClC,QAAQ,CAAC,QAAQ,CAAC,GAAG,SASvB,CAAC"}
@@ -1,48 +0,0 @@
1
- import Image from "next/image";
2
- import { cn } from "@/lib/utils";
3
-
4
- interface TemplatesProps {
5
- data: {
6
- title: string;
7
- description: string;
8
- link: string;
9
- image: string;
10
- }[];
11
- description: string;
12
- title: string;
13
- }
14
-
15
- export const Templates = ({ title, description, data }: TemplatesProps) => (
16
- <div className="grid gap-12 @min-[640px]:py-12 py-8">
17
- <div className="grid max-w-3xl gap-2 text-balance">
18
- <h2 className="font-[450]! @min-[1024px]:text-[40px] @min-[640px]:text-2xl @min-[768px]:text-3xl text-gray-1000 text-xl tracking-tighter">
19
- {title}
20
- </h2>
21
- <p className="text-balance text-gray-900 text-lg">{description}</p>
22
- </div>
23
- <div className="grid @min-[768px]:grid-cols-3 gap-8">
24
- {data.map((item) => (
25
- <a
26
- className="group flex-col overflow-hidden rounded-lg border bg-background-100 p-4"
27
- href={item.link}
28
- key={item.title}
29
- >
30
- <h3 className="font-[450] tracking-tight">{item.title}</h3>
31
- <p className="line-clamp-2 text-gray-900 text-sm">
32
- {item.description}
33
- </p>
34
- <Image
35
- alt={item.title}
36
- className={cn(
37
- "mt-8 -mb-12 ml-7 aspect-video -rotate-3 overflow-hidden rounded-md border object-cover object-top",
38
- "transition-transform duration-300 group-hover:-rotate-1 group-hover:scale-105"
39
- )}
40
- height={336}
41
- src={item.image}
42
- width={640}
43
- />
44
- </a>
45
- ))}
46
- </div>
47
- </div>
48
- );