@vercel/geistdocs 1.2.3-canary.a12a9c6 → 1.2.3-canary.fd2c9a6

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 (126) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +46 -1
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/footer.d.ts +8 -0
  5. package/dist/footer.d.ts.map +1 -0
  6. package/dist/footer.js +6 -0
  7. package/dist/home-layout.d.ts +11 -0
  8. package/dist/home-layout.d.ts.map +1 -0
  9. package/dist/home-layout.js +31 -0
  10. package/dist/internal/config-context.d.ts +10 -0
  11. package/dist/internal/config-context.d.ts.map +1 -0
  12. package/dist/internal/config-context.js +15 -0
  13. package/dist/internal/footer/github-button.d.ts +7 -0
  14. package/dist/internal/footer/github-button.d.ts.map +1 -0
  15. package/dist/internal/footer/github-button.js +10 -0
  16. package/dist/internal/footer/rss-button.d.ts +2 -0
  17. package/dist/internal/footer/rss-button.d.ts.map +1 -0
  18. package/dist/internal/footer/rss-button.js +4 -0
  19. package/dist/internal/navbar/desktop-menu.d.ts +10 -0
  20. package/dist/internal/navbar/desktop-menu.d.ts.map +1 -0
  21. package/dist/internal/navbar/desktop-menu.js +11 -0
  22. package/dist/internal/navbar/mobile-menu.d.ts +7 -0
  23. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -0
  24. package/dist/internal/navbar/mobile-menu.js +40 -0
  25. package/dist/internal/navbar/navbar-logo.d.ts +16 -0
  26. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -0
  27. package/dist/internal/navbar/navbar-logo.js +30 -0
  28. package/dist/internal/page-actions-client.d.ts.map +1 -1
  29. package/dist/internal/page-actions-client.js +12 -1
  30. package/dist/internal/page-visibility.d.ts +18 -0
  31. package/dist/internal/page-visibility.d.ts.map +1 -0
  32. package/dist/internal/page-visibility.js +24 -0
  33. package/dist/internal/provider-client.d.ts +1 -1
  34. package/dist/internal/provider-client.d.ts.map +1 -1
  35. package/dist/internal/provider-client.js +2 -1
  36. package/dist/internal/sidebar.js +1 -1
  37. package/dist/internal/ui/button.d.ts +1 -1
  38. package/dist/internal/ui/navigation-menu.d.ts +17 -0
  39. package/dist/internal/ui/navigation-menu.d.ts.map +1 -0
  40. package/dist/internal/ui/navigation-menu.js +38 -0
  41. package/dist/internal/ui/sonner.js +3 -3
  42. package/dist/mdx.d.ts +11 -0
  43. package/dist/mdx.d.ts.map +1 -1
  44. package/dist/mdx.js +8 -0
  45. package/dist/mobile-docs-bar.d.ts +7 -0
  46. package/dist/mobile-docs-bar.d.ts.map +1 -0
  47. package/dist/mobile-docs-bar.js +13 -0
  48. package/dist/navbar.d.ts +7 -0
  49. package/dist/navbar.d.ts.map +1 -0
  50. package/dist/navbar.js +10 -0
  51. package/dist/pages/docs.d.ts +2 -1
  52. package/dist/pages/docs.d.ts.map +1 -1
  53. package/dist/pages/docs.js +7 -2
  54. package/dist/proxy.d.ts +1 -1
  55. package/dist/proxy.d.ts.map +1 -1
  56. package/dist/proxy.js +28 -2
  57. package/dist/routes/agents.d.ts +21 -0
  58. package/dist/routes/agents.d.ts.map +1 -0
  59. package/dist/routes/agents.js +201 -0
  60. package/dist/routes/chat.d.ts.map +1 -1
  61. package/dist/routes/chat.js +12 -3
  62. package/dist/routes/llms.d.ts +6 -5
  63. package/dist/routes/llms.d.ts.map +1 -1
  64. package/dist/routes/llms.js +63 -12
  65. package/dist/routes/search.d.ts +6 -4
  66. package/dist/routes/search.d.ts.map +1 -1
  67. package/dist/routes/search.js +8 -1
  68. package/dist/routes/sitemap.d.ts +6 -3
  69. package/dist/routes/sitemap.d.ts.map +1 -1
  70. package/dist/routes/sitemap.js +10 -2
  71. package/dist/source.d.ts +8 -1
  72. package/dist/source.d.ts.map +1 -1
  73. package/dist/source.js +14 -1
  74. package/dist/versions.d.ts.map +1 -1
  75. package/dist/versions.js +34 -16
  76. package/package.json +23 -3
  77. package/template/AGENTS.md +69 -0
  78. package/template/app/[lang]/(home)/layout.tsx +4 -3
  79. package/template/app/[lang]/agents.md/route.ts +6 -0
  80. package/template/app/[lang]/docs/[[...slug]]/page.tsx +1 -1
  81. package/template/app/[lang]/layout.tsx +6 -6
  82. package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +1 -1
  83. package/template/app/[lang]/sitemap.md/route.ts +2 -2
  84. package/template/app/api/search/route.ts +2 -2
  85. package/template/content/docs/agent-readiness.mdx +103 -0
  86. package/template/content/docs/configuration.mdx +40 -1
  87. package/template/content/docs/index.mdx +1 -0
  88. package/template/content/docs/llms-txt.mdx +1 -0
  89. package/template/content/docs/md.mdx +2 -1
  90. package/template/content/docs/meta.json +1 -0
  91. package/template/content/docs/proxy.mdx +10 -1
  92. package/template/content/docs/theme-aware-image.mdx +1 -1
  93. package/template/geistdocs.tsx +26 -0
  94. package/template/lib/geistdocs/config.tsx +3 -0
  95. package/template/package.json +3 -3
  96. package/template/proxy.ts +0 -1
  97. package/template/source.config.ts +8 -0
  98. package/template/app/actions/feedback/emotions.ts +0 -18
  99. package/template/app/actions/feedback/index.ts +0 -45
  100. package/template/components/geistdocs/chat.tsx +0 -24
  101. package/template/components/geistdocs/desktop-menu.tsx +0 -52
  102. package/template/components/geistdocs/feedback.tsx +0 -139
  103. package/template/components/geistdocs/footer.tsx +0 -30
  104. package/template/components/geistdocs/github-button.tsx +0 -19
  105. package/template/components/geistdocs/home-layout.tsx +0 -46
  106. package/template/components/geistdocs/language-selector.tsx +0 -3
  107. package/template/components/geistdocs/mobile-docs-bar.tsx +0 -77
  108. package/template/components/geistdocs/mobile-menu.tsx +0 -150
  109. package/template/components/geistdocs/navbar-logo.tsx +0 -124
  110. package/template/components/geistdocs/navbar.tsx +0 -22
  111. package/template/components/geistdocs/rss-button.tsx +0 -10
  112. package/template/components/geistdocs/search.tsx +0 -17
  113. package/template/components/geistdocs/sidebar.tsx +0 -128
  114. package/template/components/geistdocs/theme-aware-image.tsx +0 -22
  115. package/template/components/geistdocs/theme-toggle.tsx +0 -3
  116. package/template/components/ui/card.tsx +0 -92
  117. package/template/components/ui/dialog.tsx +0 -143
  118. package/template/components/ui/input-group.tsx +0 -170
  119. package/template/components/ui/input.tsx +0 -21
  120. package/template/components/ui/navigation-menu.tsx +0 -192
  121. package/template/components/ui/popover.tsx +0 -48
  122. package/template/components/ui/separator.tsx +0 -28
  123. package/template/components/ui/sheet.tsx +0 -139
  124. package/template/components/ui/textarea.tsx +0 -18
  125. package/template/hooks/geistdocs/use-sidebar.ts +0 -13
  126. package/template/hooks/use-mobile.ts +0 -19
@@ -1,18 +1,62 @@
1
1
  import { notFound } from "next/navigation";
2
- const resolveSources = (source, sources) => {
2
+ import { isPageVisibleForSurface } from "../internal/page-visibility";
3
+ const resolveSources = (source, sources, caller) => {
3
4
  const resolvedSources = sources ?? (source ? [source] : []);
4
5
  if (resolvedSources.length === 0) {
5
- throw new Error("createLlmsRoute requires source or sources.");
6
+ throw new Error(`${caller} requires source or sources.`);
6
7
  }
7
8
  return resolvedSources;
8
9
  };
10
+ const pageUrlToSlug = (url) => url.split("/").filter(Boolean);
11
+ const getPathnameFromSlug = (slug) => {
12
+ const segments = slug ?? [];
13
+ return segments.length === 0 ? "/" : `/${segments.join("/")}`;
14
+ };
15
+ const findPageBySlug = ({ lang, slug, sources, }) => {
16
+ for (const source of sources) {
17
+ const page = source.source.getPage(slug, lang);
18
+ if (page) {
19
+ return { page, source };
20
+ }
21
+ }
22
+ const pathname = getPathnameFromSlug(slug);
23
+ for (const source of sources) {
24
+ const page = source.source
25
+ .getPages(lang)
26
+ .find((entry) => entry.url === pathname);
27
+ if (page) {
28
+ return { page, source };
29
+ }
30
+ }
31
+ return null;
32
+ };
33
+ const getMarkdownStaticParams = ({ lang, sources, }) => {
34
+ if (sources.length === 1) {
35
+ return sources[0].source.generateParams(lang);
36
+ }
37
+ const sourceLanguages = Array.from(new Set(sources.flatMap((source) => source.source.generateParams()
38
+ .map((param) => param.lang)
39
+ .filter((value) => typeof value === "string"))));
40
+ let languages = sourceLanguages.length > 0 ? sourceLanguages : ["en"];
41
+ if (lang) {
42
+ languages = [lang];
43
+ }
44
+ return languages.flatMap((language) => sources.flatMap((source) => source.source.getPages(language).map((page) => {
45
+ const params = { slug: pageUrlToSlug(page.url) };
46
+ if (!lang) {
47
+ params.lang = language;
48
+ }
49
+ return params;
50
+ })));
51
+ };
9
52
  export const createLlmsRoute = ({ filterPage, source, sources, transform, }) => {
10
- const routeSources = resolveSources(source, sources);
53
+ const routeSources = resolveSources(source, sources, "createLlmsRoute");
11
54
  const GET = async (_req, { params }) => {
12
55
  const { lang } = await params;
13
56
  const scanned = await Promise.all(routeSources.flatMap((entry) => entry.source
14
57
  .getPages(lang)
15
- .filter((page) => filterPage?.(page, { lang }) ?? true)
58
+ .filter((page) => isPageVisibleForSurface(page, "llms") &&
59
+ (filterPage?.(page, { lang }) ?? true))
16
60
  .map(async (page) => {
17
61
  const rendered = await entry.getPageMarkdown(page);
18
62
  return transform
@@ -30,23 +74,30 @@ export const createLlmsRoute = ({ filterPage, source, sources, transform, }) =>
30
74
  revalidate: false,
31
75
  };
32
76
  };
33
- export const createDocsMarkdownRoute = ({ filterStaticParams, source, transform, }) => {
77
+ export const createDocsMarkdownRoute = ({ filterStaticParams, source, sources, transform, }) => {
78
+ const routeSources = resolveSources(source, sources, "createDocsMarkdownRoute");
34
79
  const GET = async (_req, { params }) => {
35
80
  const { slug, lang } = await params;
36
- const page = source.source.getPage(slug, lang);
37
- if (!page) {
81
+ const result = findPageBySlug({ lang, slug, sources: routeSources });
82
+ if (!result) {
38
83
  notFound();
39
84
  }
40
- const rendered = await source.getPageMarkdown(page);
41
- return new Response(transform ? await transform(rendered, { lang, page, source }) : rendered, {
85
+ const { page, source: pageSource } = result;
86
+ const rendered = await pageSource.getPageMarkdown(page);
87
+ return new Response(transform
88
+ ? await transform(rendered, { lang, page, source: pageSource })
89
+ : rendered, {
42
90
  headers: {
43
91
  "Content-Type": "text/markdown",
44
92
  },
45
93
  });
46
94
  };
47
- const generateStaticParams = async ({ params, }) => {
48
- const { lang } = await params;
49
- const staticParams = source.source.generateParams(lang);
95
+ const generateStaticParams = async ({ params, } = {}) => {
96
+ const { lang } = (await params) ?? {};
97
+ const staticParams = getMarkdownStaticParams({
98
+ lang,
99
+ sources: routeSources,
100
+ });
50
101
  return filterStaticParams
51
102
  ? staticParams.filter(filterStaticParams)
52
103
  : staticParams;
@@ -1,10 +1,12 @@
1
1
  import type { GeistdocsConfig } from "../config";
2
- import type { GeistdocsSourceBundle } from "../source";
3
- type SearchSource = GeistdocsSourceBundle["source"];
2
+ import { type GeistdocsSourceBundle } from "../source";
3
+ type SourceBundle = GeistdocsSourceBundle;
4
+ type SearchSource = SourceBundle["source"];
5
+ type SearchSourceInput = SearchSource | SourceBundle;
4
6
  interface CreateSearchRouteOptions {
5
7
  config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
6
- source?: SearchSource;
7
- sources?: SearchSource[];
8
+ source?: SearchSourceInput;
9
+ sources?: SearchSourceInput[];
8
10
  }
9
11
  export declare const createSearchRoute: ({ config, source, sources, }: CreateSearchRouteOptions) => (request: Request) => Promise<Response>;
10
12
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/routes/search.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAIpD,UAAU,wBAAwB;IAChC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;CAC1B;AAiCD,eAAO,MAAM,iBAAiB,GAAI,8BAI/B,wBAAwB,4CAmE1B,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/routes/search.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AAEhF,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAC3C,KAAK,iBAAiB,GAAG,YAAY,GAAG,YAAY,CAAC;AAIrD,UAAU,wBAAwB;IAChC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAsCD,eAAO,MAAM,iBAAiB,GAAI,8BAI/B,wBAAwB,4CAqE1B,CAAC"}
@@ -2,6 +2,8 @@ import { createTokenizer as createTokenizerJapanese } from "@orama/tokenizers/ja
2
2
  import { createTokenizer as createTokenizerMandarin } from "@orama/tokenizers/mandarin";
3
3
  import { defineI18n } from "fumadocs-core/i18n";
4
4
  import { createI18nSearchAPI, } from "fumadocs-core/search/server";
5
+ import { isPageVisibleForSurface } from "../internal/page-visibility";
6
+ import { isGeistdocsSourceBundle } from "../source";
5
7
  const getLanguages = (config) => {
6
8
  const defaultLanguage = config.defaultLanguage ?? "en";
7
9
  const languages = Object.keys(config.translations ?? {});
@@ -17,6 +19,9 @@ const resolveSources = (source, sources) => {
17
19
  }
18
20
  return resolvedSources;
19
21
  };
22
+ const getPages = (source, locale) => isGeistdocsSourceBundle(source)
23
+ ? source.source.getPages(locale)
24
+ : source.getPages(locale);
20
25
  export const createSearchRoute = ({ config, source, sources, }) => {
21
26
  const translations = config.translations ?? {};
22
27
  const routeSources = resolveSources(source, sources);
@@ -52,7 +57,9 @@ export const createSearchRoute = ({ config, source, sources, }) => {
52
57
  },
53
58
  };
54
59
  }
55
- const getIndexes = () => languages.flatMap((locale) => routeSources.flatMap((source) => source.getPages(locale).map((page) => {
60
+ const getIndexes = () => languages.flatMap((locale) => routeSources.flatMap((source) => getPages(source, locale)
61
+ .filter((page) => isPageVisibleForSurface(page, "search"))
62
+ .map((page) => {
56
63
  const data = page.data;
57
64
  return {
58
65
  id: page.url,
@@ -1,5 +1,7 @@
1
1
  import type { NextRequest } from "next/server";
2
2
  import type { GeistdocsConfig } from "../config";
3
+ import { type GeistdocsPageVisibilityData } from "../internal/page-visibility";
4
+ import { type GeistdocsSourceBundle } from "../source";
3
5
  interface SitemapPage {
4
6
  data: {
5
7
  title?: string;
@@ -9,19 +11,20 @@ interface SitemapPage {
9
11
  prerequisites?: string[];
10
12
  product?: string;
11
13
  lastModified?: Date;
12
- };
14
+ } & GeistdocsPageVisibilityData;
13
15
  url: string;
14
16
  }
15
17
  interface SitemapSource {
16
18
  getPages(lang: string): SitemapPage[];
17
19
  }
20
+ type SitemapSourceInput = GeistdocsSourceBundle | SitemapSource;
18
21
  interface SitemapSection {
19
- source: SitemapSource;
22
+ source: SitemapSourceInput;
20
23
  title?: string;
21
24
  }
22
25
  interface CreateSitemapMarkdownRouteOptions {
23
26
  config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
24
- source?: SitemapSource;
27
+ source?: SitemapSourceInput;
25
28
  sources?: SitemapSection[];
26
29
  title?: string;
27
30
  transform?: (markdown: string, context: {
@@ -1 +1 @@
1
- {"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/routes/sitemap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,WAAW;IACnB,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CA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AAW;IACnB,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,IAAI,CAAC;KACrB,GAAG,2BAA2B,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAAC;CACvC;AAED,KAAK,kBAAkB,GAAG,qBAAqB,GAAG,aAAa,CAAC;AAEhE,UAAU,cAAc;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iCAAiC;IACzC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,CACV,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KACtB,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;CAC/B;AA+KD,eAAO,MAAM,0BAA0B,GAAI,gDAMxC,iCAAiC;gBAK1B,WAAW,cACL;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE;;;;;;CA0DpD,CAAC"}
@@ -1,3 +1,5 @@
1
+ import { isPageVisibleForSurface, } from "../internal/page-visibility";
2
+ import { isGeistdocsSourceBundle } from "../source";
1
3
  const DOCS_PREFIX_PATTERN = /^\/docs\/?/;
2
4
  const WHITESPACE_PATTERN = /\s+/;
3
5
  const getLanguages = (config) => {
@@ -118,6 +120,11 @@ const resolveSitemapSections = (source, sources) => {
118
120
  }
119
121
  return sections;
120
122
  };
123
+ const getSectionPages = (source, lang) => isGeistdocsSourceBundle(source)
124
+ ? source.source.getPages(lang)
125
+ : source.getPages(lang);
126
+ const getSectionTitle = (section) => section.title ??
127
+ (isGeistdocsSourceBundle(section.source) ? section.source.label : undefined);
121
128
  export const createSitemapMarkdownRoute = ({ config, source, sources, title = "Documentation Sitemap", transform, }) => {
122
129
  const languages = getLanguages(config);
123
130
  const sections = resolveSitemapSections(source, sources);
@@ -141,12 +148,13 @@ It is not intended to replace individual docs.
141
148
  `;
142
149
  const body = sections
143
150
  .map((section) => {
144
- const pages = section.source.getPages(lang);
151
+ const pages = getSectionPages(section.source, lang).filter((page) => isPageVisibleForSurface(page, "sitemap"));
145
152
  const tree = buildTree(pages);
146
153
  const renderedTree = tree
147
154
  .map((node) => renderNode(node, 0))
148
155
  .join("\n\n");
149
- return [section.title && `## ${section.title}\n`, renderedTree]
156
+ const sectionTitle = getSectionTitle(section);
157
+ return [sectionTitle && `## ${sectionTitle}\n`, renderedTree]
150
158
  .filter(Boolean)
151
159
  .join("\n");
152
160
  })
package/dist/source.d.ts CHANGED
@@ -1,17 +1,23 @@
1
1
  import { type InferPageType, loader } from "fumadocs-core/source";
2
- import type { GeistdocsConfig } from "./config";
2
+ import type { GeistdocsConfig, GeistdocsPageSurface } from "./config";
3
3
  type LoaderOptions = Parameters<typeof loader>[0];
4
4
  export interface FumadocsCollection {
5
5
  toFumadocsSource(): LoaderOptions["source"];
6
6
  }
7
7
  export interface GeistdocsSourcePageData {
8
+ canonical?: string;
8
9
  description?: string;
10
+ excludeFrom?: GeistdocsPageSurface[];
9
11
  getText(kind: "processed"): Promise<string>;
12
+ internal?: boolean;
13
+ keywords?: string[];
10
14
  lastModified?: Date;
15
+ noindex?: boolean;
11
16
  prerequisites?: string[];
12
17
  product?: string;
13
18
  related?: string[];
14
19
  summary?: string;
20
+ tags?: string[];
15
21
  title: string;
16
22
  type?: string;
17
23
  }
@@ -73,6 +79,7 @@ export declare const createSource: ({ docs, config, baseUrl, id, label, markdown
73
79
  }>>) => Promise<string>;
74
80
  };
75
81
  export type GeistdocsSourceBundle = ReturnType<typeof createSource>;
82
+ export declare const isGeistdocsSourceBundle: (source: unknown) => source is GeistdocsSourceBundle;
76
83
  export declare const createSources: ({ config, sources }: CreateSourcesOptions) => {
77
84
  all: {
78
85
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,uBAAuB,CAAC;QAC9B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,M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,CAAC,CAAC;IACtC,OAAO,EAAE,yBAAyB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kCAAkC,EAAE,CAAC;CAChD;AAcD,eAAO,MAAM,YAAY,GAAI,iDAO1B,mBAAmB;;;;;;;;yBAeQ,aAAa;;;OAAe;;;;4BAWnB,aAAa;;;OAAe;CA0ElE,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAEpE,eAAO,MAAM,uBAAuB,GAClC,QAAQ,OAAO,KACd,MAAM,IAAI,qBAKC,CAAC;AAEf,eAAO,MAAM,aAAa,GAAI,qBAAqB,oBAAoB;;;;;;;;;;;;iCAlGzC,aAAa;;;eAAe;;;;oCAWnB,aAAa;;;eAAe;;;UA2G1D,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC;CAE7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,gCAIpC,6BAA6B;;;;;;;;;;;;;;;iCA9HF,aAAa;;;eAAe;;;;oCAWnB,aAAa;;;eAAe;;;;;;;;;;;6BAXrC,aAAa;;;WAAe;;;;gCAWnB,aAAa;;;WAAe;;;;;;;;;;6BAXrC,aAAa;;;WAAe;;;;gCAWnB,aAAa;;;WAAe;;;CAsJlE,CAAC"}
package/dist/source.js CHANGED
@@ -34,7 +34,7 @@ export const createSource = ({ docs, config, baseUrl = "/docs", id, label, markd
34
34
  const getPageMarkdown = async (page) => {
35
35
  const data = page.data;
36
36
  const processed = await data.getText("processed");
37
- const { title, description, product, type, summary, prerequisites, related, } = data;
37
+ const { title, description, product, type, summary, prerequisites, related, internal, noindex, canonical, tags, keywords, excludeFrom, } = data;
38
38
  const frontmatter = [
39
39
  "---",
40
40
  `title: ${title}`,
@@ -42,6 +42,14 @@ export const createSource = ({ docs, config, baseUrl = "/docs", id, label, markd
42
42
  product && `product: ${product}`,
43
43
  type && `type: ${type}`,
44
44
  summary && `summary: ${summary}`,
45
+ internal && "internal: true",
46
+ noindex && "noindex: true",
47
+ canonical && `canonical: ${canonical}`,
48
+ tags?.length && `tags:\n${tags.map((tag) => ` - ${tag}`).join("\n")}`,
49
+ keywords?.length &&
50
+ `keywords:\n${keywords.map((keyword) => ` - ${keyword}`).join("\n")}`,
51
+ excludeFrom?.length &&
52
+ `excludeFrom:\n${excludeFrom.map((surface) => ` - ${surface}`).join("\n")}`,
45
53
  prerequisites?.length &&
46
54
  `prerequisites:\n${prerequisites
47
55
  .map((prerequisite) => ` - ${prerequisite}`)
@@ -79,6 +87,11 @@ For an index of all available documentation, see [/llms.txt](/llms.txt)`;
79
87
  getPageMarkdown,
80
88
  };
81
89
  };
90
+ export const isGeistdocsSourceBundle = (source) => typeof source === "object" &&
91
+ source !== null &&
92
+ "source" in source &&
93
+ typeof source.getPageMarkdown ===
94
+ "function";
82
95
  export const createSources = ({ config, sources }) => {
83
96
  const all = sources.map(({ id, label, ...sourceOptions }) => {
84
97
  const bundle = createSource({
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEhF,UAAU,yBAAyB;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,UAAU,2BAA2B;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,sBAAsB,EAAE,GAAG,uBAAuB,CAAC;CAC9D;AAsBD,eAAO,MAAM,kBAAkB,GAAI,wCAIhC,yBAAyB,WAmB3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,mCAIpC,2BAA2B,mDA2C7B,CAAC"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../src/versions.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAShF,UAAU,yBAAyB;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,UAAU,2BAA2B;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,sBAAsB,EAAE,GAAG,uBAAuB,CAAC;CAC9D;AA+CD,eAAO,MAAM,kBAAkB,GAAI,wCAIhC,yBAAyB,WAmB3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,mCAIpC,2BAA2B,mDAuF7B,CAAC"}
package/dist/versions.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { usePathname } from "next/navigation";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArchiveIcon, BoxIcon, CheckIcon, ChevronDownIcon } from "lucide-react";
4
+ import { usePathname, useRouter } from "next/navigation";
5
+ import { cn } from "./internal/cn";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./internal/ui/dropdown-menu";
4
7
  const LEADING_SLASH_PATTERN = /^\//;
5
8
  const PATH_TOKEN_PATTERN = /:path\*|\*path/g;
6
9
  const TRAILING_SLASH_PATTERN = /\/$/;
@@ -13,6 +16,13 @@ const removeRoutePrefix = (pathname, version) => {
13
16
  ? pathname.slice(version.routePrefix.length) || "/"
14
17
  : pathname;
15
18
  };
19
+ const getVersionDescription = ({ current, version, }) => version.description ?? (current ? "Current version" : "Previous version");
20
+ const VersionIcon = ({ active }) => {
21
+ const Icon = active ? BoxIcon : ArchiveIcon;
22
+ return (_jsx("span", { className: cn("flex size-9 shrink-0 items-center justify-center rounded-lg border", active
23
+ ? "border-blue-500 bg-blue-100 text-blue-900"
24
+ : "border-gray-alpha-400 bg-gray-100 text-gray-800"), children: _jsx(Icon, { className: "size-5" }) }));
25
+ };
16
26
  export const resolveVersionHref = ({ currentVersion, pathname, version, }) => {
17
27
  const normalizedPathname = normalizePathname(pathname);
18
28
  const pathWithoutCurrentPrefix = removeRoutePrefix(normalizedPathname, currentVersion);
@@ -28,25 +38,33 @@ export const resolveVersionHref = ({ currentVersion, pathname, version, }) => {
28
38
  };
29
39
  export const GeistdocsVersionSelect = ({ className, current, versions, }) => {
30
40
  const pathname = usePathname();
41
+ const router = useRouter();
31
42
  const items = Array.isArray(versions) ? versions : versions.items;
32
43
  const currentId = current ?? (Array.isArray(versions) ? items[0]?.id : versions.current);
33
44
  const currentVersion = items.find((version) => version.id === currentId);
34
45
  if (!currentId || items.length === 0) {
35
46
  return null;
36
47
  }
37
- return (_jsx("select", { "aria-label": "Select documentation version", className: className, onChange: (event) => {
38
- const nextVersion = items.find((version) => version.id === event.currentTarget.value);
39
- if (!nextVersion) {
40
- return;
41
- }
42
- const href = resolveVersionHref({
43
- currentVersion,
44
- pathname,
45
- version: nextVersion,
46
- });
47
- const url = new URL(href, window.location.href);
48
- url.search = window.location.search;
49
- url.hash = window.location.hash;
48
+ const navigateToVersion = (version) => {
49
+ const href = resolveVersionHref({
50
+ currentVersion,
51
+ pathname,
52
+ version,
53
+ });
54
+ const url = new URL(href, window.location.href);
55
+ url.search = window.location.search;
56
+ url.hash = window.location.hash;
57
+ if (url.origin !== window.location.origin) {
50
58
  window.location.href = url.toString();
51
- }, value: currentId, children: items.map((version) => (_jsx("option", { value: version.id, children: version.label }, version.id))) }));
59
+ return;
60
+ }
61
+ router.push(`${url.pathname}${url.search}${url.hash}`);
62
+ };
63
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { "aria-label": "Select documentation version", className: cn("group flex w-full items-center gap-3 rounded-xl px-2 py-2 text-left outline-none transition-colors hover:bg-gray-100 focus-visible:ring-2 focus-visible:ring-blue-700", className), type: "button", children: [currentVersion ? _jsx(VersionIcon, { active: true }) : null, _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium text-gray-1000 text-sm leading-5", children: currentVersion?.label ?? currentId }), currentVersion ? (_jsx("span", { className: "block truncate text-gray-800 text-sm leading-5", children: getVersionDescription({
64
+ current: true,
65
+ version: currentVersion,
66
+ }) })) : null] }), _jsx(ChevronDownIcon, { className: "size-4 shrink-0 text-gray-900 transition-transform group-data-[state=open]:rotate-180" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "w-(--radix-dropdown-menu-trigger-width) min-w-64 rounded-xl border border-gray-alpha-400 bg-background-100 p-1 shadow-(--ds-shadow-menu)", children: items.map((version) => {
67
+ const active = version.id === currentId;
68
+ return (_jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-center gap-3 rounded-lg px-2 py-2", onSelect: () => navigateToVersion(version), children: [_jsx(VersionIcon, { active: active }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium text-gray-1000 text-sm leading-5", children: version.label }), _jsx("span", { className: "block truncate text-gray-800 text-sm leading-5", children: getVersionDescription({ current: active, version }) })] }), active ? _jsx(CheckIcon, { className: "size-4 text-blue-900" }) : null] }, version.id));
69
+ }) })] }));
52
70
  };
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": "1.2.3-canary.a12a9c6",
4
+ "version": "1.2.3-canary.fd2c9a6",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/vercel/geistdocs",
@@ -28,6 +28,22 @@
28
28
  "types": "./dist/layout.d.ts",
29
29
  "default": "./dist/layout.js"
30
30
  },
31
+ "./navbar": {
32
+ "types": "./dist/navbar.d.ts",
33
+ "default": "./dist/navbar.js"
34
+ },
35
+ "./footer": {
36
+ "types": "./dist/footer.d.ts",
37
+ "default": "./dist/footer.js"
38
+ },
39
+ "./home-layout": {
40
+ "types": "./dist/home-layout.d.ts",
41
+ "default": "./dist/home-layout.js"
42
+ },
43
+ "./mobile-docs-bar": {
44
+ "types": "./dist/mobile-docs-bar.d.ts",
45
+ "default": "./dist/mobile-docs-bar.js"
46
+ },
31
47
  "./controls": {
32
48
  "types": "./dist/controls.d.ts",
33
49
  "default": "./dist/controls.js"
@@ -64,6 +80,10 @@
64
80
  "types": "./dist/routes/sitemap.d.ts",
65
81
  "default": "./dist/routes/sitemap.js"
66
82
  },
83
+ "./routes/agents": {
84
+ "types": "./dist/routes/agents.d.ts",
85
+ "default": "./dist/routes/agents.js"
86
+ },
67
87
  "./proxy": {
68
88
  "types": "./dist/proxy.d.ts",
69
89
  "default": "./dist/proxy.js"
@@ -160,7 +180,7 @@
160
180
  "zod": "^4.1.13"
161
181
  },
162
182
  "peerDependencies": {
163
- "next": "16.0.10",
183
+ "next": "16.2.6",
164
184
  "react": "^19.2.3",
165
185
  "react-dom": "^19.2.3"
166
186
  },
@@ -171,7 +191,7 @@
171
191
  "@types/node": "^24.10.1",
172
192
  "@types/react": "^19.2.7",
173
193
  "@types/react-dom": "^19.2.3",
174
- "next": "16.0.10",
194
+ "next": "16.2.6",
175
195
  "react": "^19.2.3",
176
196
  "react-dom": "^19.2.3",
177
197
  "tsup": "^8.5.1",
@@ -0,0 +1,69 @@
1
+ # Geistdocs agent instructions
2
+
3
+ This project uses the packaged Geistdocs architecture. The `@vercel/geistdocs` package owns shared runtime behavior; this app owns local content, configuration, adapters, and site-specific routes.
4
+
5
+ Use these instructions when an AI coding agent edits this project.
6
+
7
+ ## Architecture
8
+
9
+ - Runtime features come from `@vercel/geistdocs`, including the docs page renderer, layout helpers, MDX components, search, Ask AI, markdown routes, proxy helpers, and source helpers.
10
+ - Local files are user-owned adapters. They should stay thin and call public package exports from `@vercel/geistdocs/*`.
11
+ - Do not copy package internals into the app to make a customization. Prefer configuring an adapter file or upgrading `@vercel/geistdocs`.
12
+ - Do not deep import from `@vercel/geistdocs/dist` or edit files in `node_modules/@vercel/geistdocs`.
13
+ - Do not edit generated directories such as `.source/`, `.next/`, `node_modules/`, or build output.
14
+
15
+ ## Common edit targets
16
+
17
+ | Task | Edit |
18
+ | --- | --- |
19
+ | Configure site title, logo, nav, GitHub links, AI prompt, suggestions, translations, `basePath`, or `siteId` | `geistdocs.tsx` |
20
+ | Add or update documentation pages | `content/docs/**/*.mdx` |
21
+ | Control sidebar order, groups, and labels | `content/docs/meta.json` |
22
+ | Override MDX components | `components/geistdocs/mdx-components.tsx` |
23
+ | Wrap the site provider, analytics, or global client behavior | `components/geistdocs/provider.tsx` |
24
+ | Customize the docs layout shell | `components/geistdocs/docs-layout.tsx` |
25
+ | Configure the Fumadocs source adapter or versioned docs | `lib/geistdocs/source.ts` |
26
+ | Configure the docs page renderer | `app/[lang]/docs/[[...slug]]/page.tsx` |
27
+ | Configure AI-readable markdown output | `app/[lang]/llms.txt/route.ts`, `app/[lang]/llms.mdx/[[...slug]]/route.ts`, `app/[lang]/sitemap.md/route.ts` |
28
+ | Configure chat or search APIs | `app/api/chat/route.ts`, `app/api/search/route.ts` |
29
+ | Add request handling before or after Geistdocs routing | `proxy.ts` |
30
+ | Edit the marketing home page | `app/[lang]/(home)/**` |
31
+ | Edit shared styles | `app/global.css`, `app/styles/geistdocs.css` |
32
+
33
+ ## Content guidelines
34
+
35
+ - Put docs in `content/docs` unless the project has added another source in `lib/geistdocs/source.ts`.
36
+ - Add each new page to `content/docs/meta.json` so it appears in the sidebar.
37
+ - Use MDX frontmatter with at least `title` and `description` for documentation pages.
38
+ - Keep slugs stable unless the task explicitly includes redirects or link updates.
39
+ - When adding translated content, follow the existing locale suffix pattern, such as `page.cn.mdx`.
40
+ - Use `CopyPrompt` when a page should give readers a prompt they can copy into a coding agent.
41
+
42
+ ## Routing and proxy guidelines
43
+
44
+ - Keep App Router route files as thin adapters around package helpers such as `createDocsPage`, `createChatRoute`, `createLlmsRoute`, and `createProxy`.
45
+ - Keep `export const config` in `proxy.ts` as a static object. Next.js must parse proxy matchers at build time.
46
+ - Preserve markdown negotiation unless the task explicitly changes AI-readable output. Geistdocs serves `/llms.txt` and per-page Markdown for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
47
+ - When adding custom proxy behavior, prefer `before`, `after`, and `markdownRoutes` options on `createProxy` instead of replacing the proxy.
48
+
49
+ ## Package updates
50
+
51
+ - Use `pnpm exec geistdocs update` to update package-based Geistdocs projects.
52
+ - `geistdocs update` updates the `@vercel/geistdocs` dependency. It does not overwrite local adapter files.
53
+ - Review dependency changes and run the verification commands before committing an update.
54
+
55
+ ## Commands
56
+
57
+ - Start development: `pnpm dev`
58
+ - Build for production: `pnpm build`
59
+ - Start the built app: `pnpm start`
60
+ - Regenerate Fumadocs output after dependency installation: `pnpm postinstall`
61
+ - Update Geistdocs: `pnpm exec geistdocs update`
62
+ - Run translations if configured: `pnpm translate`
63
+
64
+ ## Verification
65
+
66
+ - Run `pnpm build` after changing routes, config, source setup, MDX components, or package versions.
67
+ - Run `pnpm dev` and open the changed pages when visual layout, navigation, or MDX rendering changes.
68
+ - Check both `/docs` and AI-readable routes such as `/llms.txt` or a page-level `.md` URL when changing content routing or proxy behavior.
69
+ - Confirm no secrets were added to source files. Use `.env.local` for local values and keep it out of Git.
@@ -1,13 +1,14 @@
1
- import { HomeLayout } from "@/components/geistdocs/home-layout";
1
+ import { GeistdocsHomeLayout } from "@vercel/geistdocs/home-layout";
2
+ import { config } from "@/lib/geistdocs/config";
2
3
  import { source } from "@/lib/geistdocs/source";
3
4
 
4
5
  const Layout = async ({ children, params }: LayoutProps<"/[lang]">) => {
5
6
  const { lang } = await params;
6
7
 
7
8
  return (
8
- <HomeLayout tree={source.pageTree[lang]}>
9
+ <GeistdocsHomeLayout config={config} tree={source.pageTree[lang]}>
9
10
  <div className="pt-0 pb-32">{children}</div>
10
- </HomeLayout>
11
+ </GeistdocsHomeLayout>
11
12
  );
12
13
  };
13
14
 
@@ -0,0 +1,6 @@
1
+ import { createAgentsRoute } from "@vercel/geistdocs/routes/agents";
2
+ import { config } from "@/lib/geistdocs/config";
3
+
4
+ export const { GET, generateStaticParams, revalidate } = createAgentsRoute({
5
+ config,
6
+ });
@@ -1,6 +1,6 @@
1
+ import { MobileDocsBar } from "@vercel/geistdocs/mobile-docs-bar";
1
2
  import { createDocsPage } from "@vercel/geistdocs/pages/docs";
2
3
  import { getMDXComponents } from "@/components/geistdocs/mdx-components";
3
- import { MobileDocsBar } from "@/components/geistdocs/mobile-docs-bar";
4
4
  import { config } from "@/lib/geistdocs/config";
5
5
  import { geistdocsSource } from "@/lib/geistdocs/source";
6
6
 
@@ -1,8 +1,8 @@
1
1
  import "../global.css";
2
- import { Footer } from "@/components/geistdocs/footer";
3
- import { Navbar } from "@/components/geistdocs/navbar";
2
+ import { Footer } from "@vercel/geistdocs/footer";
3
+ import { Navbar } from "@vercel/geistdocs/navbar";
4
4
  import { GeistdocsProvider } from "@/components/geistdocs/provider";
5
- import { basePath } from "@/geistdocs";
5
+ import { config } from "@/lib/geistdocs/config";
6
6
  import { mono, sans } from "@/lib/geistdocs/fonts";
7
7
  import { cn } from "@/lib/utils";
8
8
 
@@ -16,10 +16,10 @@ const Layout = async ({ children, params }: LayoutProps<"/[lang]">) => {
16
16
  suppressHydrationWarning
17
17
  >
18
18
  <body>
19
- <GeistdocsProvider basePath={basePath} lang={lang}>
20
- <Navbar />
19
+ <GeistdocsProvider basePath={config.basePath} lang={lang}>
20
+ <Navbar config={config} />
21
21
  {children}
22
- <Footer />
22
+ <Footer config={config} />
23
23
  </GeistdocsProvider>
24
24
  </body>
25
25
  </html>
@@ -3,5 +3,5 @@ import { geistdocsSource } from "@/lib/geistdocs/source";
3
3
 
4
4
  export const { GET, generateStaticParams, revalidate } =
5
5
  createDocsMarkdownRoute({
6
- source: geistdocsSource,
6
+ sources: [geistdocsSource],
7
7
  });
@@ -1,9 +1,9 @@
1
1
  import { createSitemapMarkdownRoute } from "@vercel/geistdocs/routes/sitemap";
2
2
  import { config } from "@/lib/geistdocs/config";
3
- import { source } from "@/lib/geistdocs/source";
3
+ import { geistdocsSource } from "@/lib/geistdocs/source";
4
4
 
5
5
  export const { GET, generateStaticParams, revalidate, dynamic } =
6
6
  createSitemapMarkdownRoute({
7
7
  config,
8
- sources: [{ source }],
8
+ sources: [{ source: geistdocsSource }],
9
9
  });
@@ -1,5 +1,5 @@
1
1
  import { createSearchRoute } from "@vercel/geistdocs/routes/search";
2
2
  import { config } from "@/lib/geistdocs/config";
3
- import { source } from "@/lib/geistdocs/source";
3
+ import { geistdocsSource } from "@/lib/geistdocs/source";
4
4
 
5
- export const GET = createSearchRoute({ config, sources: [source] });
5
+ export const GET = createSearchRoute({ config, sources: [geistdocsSource] });