@vercel/geistdocs 1.22.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/footer.d.ts.map +1 -1
- package/dist/footer.js +5 -0
- package/dist/home-layout.d.ts +2 -2
- package/dist/home-layout.d.ts.map +1 -1
- package/dist/home-layout.js +52 -18
- package/dist/internal/localized-link.js +1 -1
- package/dist/internal/page-actions-client.d.ts.map +1 -1
- package/dist/internal/page-actions-client.js +18 -2
- package/dist/localize-href.d.ts +6 -0
- package/dist/localize-href.d.ts.map +1 -0
- package/dist/{internal/localize-href.js → localize-href.js} +2 -5
- package/dist/{internal/page-visibility.d.ts → page-visibility.d.ts} +1 -1
- package/dist/page-visibility.d.ts.map +1 -0
- package/dist/pages/docs.d.ts +2 -2
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +10 -5
- package/dist/proxy.d.ts +1 -1
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +13 -2
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +4 -4
- package/dist/routes/chat.js +1 -1
- package/dist/routes/llms.js +1 -1
- package/dist/routes/not-found.d.ts +14 -0
- package/dist/routes/not-found.d.ts.map +1 -0
- package/dist/routes/not-found.js +74 -0
- package/dist/routes/search.js +1 -1
- package/dist/routes/sitemap.d.ts +1 -1
- package/dist/routes/sitemap.d.ts.map +1 -1
- package/dist/routes/sitemap.js +1 -1
- package/docs/agents.md +1 -1
- package/docs/llms.txt +8 -4
- package/docs/manifest.json +1 -1
- package/docs/pages/agent-readiness.md +1 -1
- package/docs/pages/env.md +2 -2
- package/docs/pages/md.md +2 -0
- package/docs/pages/proxy.md +2 -0
- package/package.json +13 -1
- package/template/app/[lang]/(home)/components/text-grid-section.tsx +25 -11
- package/template/app/[lang]/(home)/opengraph-image.tsx +40 -0
- package/template/app/[lang]/(home)/page.tsx +143 -89
- package/template/app/[lang]/[...not-found]/route.ts +4 -0
- package/template/app/[lang]/layout.tsx +7 -0
- package/template/app/[lang]/not-found.tsx +37 -0
- package/template/app/[lang]/rss.xml/route.ts +3 -4
- package/template/app/robots.ts +4 -4
- package/template/app/sitemap.ts +11 -8
- package/template/content/docs/agent-readiness.mdx +1 -1
- package/template/content/docs/env.mdx +2 -2
- package/template/content/docs/md.mdx +2 -0
- package/template/content/docs/proxy.mdx +2 -0
- package/template/lib/geistdocs/config.tsx +2 -0
- package/template/lib/geistdocs/public-path.ts +14 -0
- package/template/lib/geistdocs/site-url-warning.ts +10 -0
- package/template/lib/geistdocs/site-url.ts +33 -0
- package/template/next.config.ts +0 -10
- package/template/package.json +1 -1
- package/dist/internal/localize-href.d.ts +0 -9
- package/dist/internal/localize-href.d.ts.map +0 -1
- package/dist/internal/page-visibility.d.ts.map +0 -1
- package/template/app/[lang]/(home)/components/templates.tsx +0 -48
- /package/dist/{internal/page-visibility.js → page-visibility.js} +0 -0
package/template/app/sitemap.ts
CHANGED
|
@@ -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)
|
|
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
|
-
|
|
20
|
-
|
|
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.
|
|
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
|
-
|
|
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,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();
|
package/template/next.config.ts
CHANGED
|
@@ -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([]);
|
package/template/package.json
CHANGED
|
@@ -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.
|
|
21
|
+
"@vercel/geistdocs": "1.23.0",
|
|
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
|
-
);
|
|
File without changes
|