Skip to content

Commit b26c3a9

Browse files
feat: agent discovery (Link headers, markdown negotiation, Content-Signal)
- Add `Content-Signal: search=yes, ai-train=yes, ai-input=yes` to robots.txt - Add `Link` response headers advertising `/api-reference/introduction` (service-doc) and `/sitemap.xml` (sitemap) - Serve source markdown when `Accept: text/markdown` is sent — static `.md` files copied into `dist` by a VitePress `buildEnd` hook, routed via a Vercel `rewrites` header matcher
1 parent 1039ae5 commit b26c3a9

3 files changed

Lines changed: 48 additions & 2 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { readFileSync } from "fs";
2-
import { resolve } from "path";
1+
import { copyFileSync, mkdirSync, readFileSync, readdirSync, statSync } from "fs";
2+
import { dirname, join, relative, resolve } from "path";
33
import { defineConfig, type HeadConfig } from "vitepress";
44
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
55

@@ -50,6 +50,30 @@ export default defineConfig({
5050
description: "Modern project management software",
5151
cleanUrls: true,
5252

53+
buildEnd(siteConfig) {
54+
// Copy source .md files into dist/ for Accept: text/markdown negotiation.
55+
const srcDir = siteConfig.srcDir;
56+
const outDir = siteConfig.outDir;
57+
58+
function walk(dir: string): void {
59+
for (const entry of readdirSync(dir)) {
60+
if (entry === ".vitepress" || entry === "public" || entry === "node_modules") continue;
61+
const abs = join(dir, entry);
62+
const stat = statSync(abs);
63+
if (stat.isDirectory()) {
64+
walk(abs);
65+
} else if (stat.isFile() && abs.endsWith(".md")) {
66+
const rel = relative(srcDir, abs);
67+
const dest = join(outDir, rel);
68+
mkdirSync(dirname(dest), { recursive: true });
69+
copyFileSync(abs, dest);
70+
}
71+
}
72+
}
73+
74+
walk(srcDir);
75+
},
76+
5377
head: [
5478
[
5579
"link",

docs/public/robots.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ Disallow: /core-concepts/issues.html
66
Disallow: /core-concepts/projects/run-project
77
Disallow: /importers/github-imp
88

9+
# Content Signals — AI content usage preferences
10+
# https://contentsignals.org/
11+
Content-Signal: search=yes, ai-train=yes, ai-input=yes
12+
913
Sitemap: https://docs.plane.so/sitemap.xml

vercel.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
{
22
"cleanUrls": true,
33
"trailingSlash": false,
4+
"headers": [
5+
{
6+
"source": "/(.*)",
7+
"headers": [
8+
{
9+
"key": "Link",
10+
"value": "</api-reference/introduction>; rel=\"service-doc\"; type=\"text/html\", </sitemap.xml>; rel=\"sitemap\"; type=\"application/xml\""
11+
}
12+
]
13+
}
14+
],
415
"redirects": [
516
{
617
"source": "/quick-start",
@@ -262,5 +273,12 @@
262273
"source": "/performance/hyper-mode",
263274
"destination": "/"
264275
}
276+
],
277+
"rewrites": [
278+
{
279+
"source": "/:path*",
280+
"has": [{ "type": "header", "key": "accept", "value": ".*text/markdown.*" }],
281+
"destination": "/:path*.md"
282+
}
265283
]
266284
}

0 commit comments

Comments
 (0)