diff --git a/app/src/app/llms.txt/route.ts b/app/src/app/llms.txt/route.ts new file mode 100644 index 00000000..a07d6111 --- /dev/null +++ b/app/src/app/llms.txt/route.ts @@ -0,0 +1,30 @@ +import { ROOT_LLMS_TXT_CACHE_HEADERS, setDocsCacheHeaders } from "@/proxy"; + +const LLMS_TXT = `# docs.page + +> docs.page hosts agent-ready documentation from any GitHub Markdown repository — with search, AI chat, an MCP server, and llms.txt — and no build step. + +## Documentation +- [Documentation](https://use.docs.page): full product documentation +- [Get started](https://use.docs.page/quickstart): quickstart guide +- [CLI](https://use.docs.page/reference/cli): local preview and project tooling +- [GitHub](https://github.com/invertase/docs.page): source repository (Apache-2.0) + +## Agent surfaces +Every site hosted on docs.page exposes machine-readable endpoints at a predictable per-repository pattern, where \`{owner}/{repo}\` is the backing GitHub repository: +- \`https://docs.page/{owner}/{repo}/llms.txt\`: LLM-oriented index of the site's pages +- \`https://docs.page/{owner}/{repo}/llms-full.txt\`: full concatenated Markdown of the site +- \`https://docs.page/{owner}/{repo}/mcp\`: Model Context Protocol server (tools: read_doc_page, list_doc_files) +- \`https://docs.page/{owner}/{repo}/search.json\`: search index +- Append \`.md\` or \`.mdx\` to any documentation page URL to fetch its raw Markdown source +`; + +export function GET() { + const response = new Response(LLMS_TXT, { + headers: { + "Content-Type": "text/plain; charset=utf-8", + }, + }); + setDocsCacheHeaders(response.headers, ROOT_LLMS_TXT_CACHE_HEADERS); + return response; +} diff --git a/app/src/proxy.ts b/app/src/proxy.ts index 407c7bb5..38a81917 100644 --- a/app/src/proxy.ts +++ b/app/src/proxy.ts @@ -80,6 +80,16 @@ export const LLMS_FULL_TXT_CACHE_HEADERS = buildCdnCacheHeaders({ staleWhileRevalidate: CDN_STALE_SECONDS, staleIfError: CDN_STALE_SECONDS, }); +/** + * Root product-level `llms.txt`: a hand-written static file that changes rarely, + * so it tolerates a day-long edge TTL and hourly browser revalidation. + */ +export const ROOT_LLMS_TXT_CACHE_HEADERS = buildCdnCacheHeaders({ + edgeMaxAgeSeconds: SECONDS_PER_DAY, + staleWhileRevalidate: CDN_STALE_SECONDS, + staleIfError: CDN_STALE_SECONDS, + browserMaxAgeSeconds: 60 * 60, +}); export const SITEMAP_CACHE_HEADERS = buildCdnCacheHeaders({ edgeMaxAgeSeconds: 3600, staleWhileRevalidate: CDN_STALE_SECONDS,