From 53250fd23bb40d1cda1cdf33e60be03c204812fe Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 7 Apr 2026 17:42:14 -0600 Subject: [PATCH] feat: enhance documentation routes to exclude API pages and add API reference links - Updated `llms-full.txt` route to filter out API documentation pages and include a link to the OpenAPI specification. - Modified `llms.txt` route to also exclude API pages and added a section for the OpenAPI specification link. - Improved overall structure of the response content for better clarity and organization. --- apps/docs/app/llms-full.txt/route.ts | 17 +++++++++++++++-- apps/docs/app/llms.txt/route.ts | 11 +++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/apps/docs/app/llms-full.txt/route.ts b/apps/docs/app/llms-full.txt/route.ts index b5b8fe6..1373093 100644 --- a/apps/docs/app/llms-full.txt/route.ts +++ b/apps/docs/app/llms-full.txt/route.ts @@ -2,9 +2,22 @@ import { getLLMText, source } from "@/lib/source"; export const revalidate = false; +const baseUrl = "https://docs.dokploy.com"; + export async function GET() { - const scan = source.getPages().map(getLLMText); + const pages = source + .getPages() + .filter((page) => !page.url.startsWith("/docs/api/")); + + const scan = pages.map(getLLMText); const scanned = await Promise.all(scan); - return new Response(scanned.join("\n\n")); + const content = [ + ...scanned, + "# API Reference", + "", + `For the complete API reference, see the OpenAPI specification: ${baseUrl}/openapi.json`, + ]; + + return new Response(content.join("\n\n")); } diff --git a/apps/docs/app/llms.txt/route.ts b/apps/docs/app/llms.txt/route.ts index 0f8e68f..2d64990 100644 --- a/apps/docs/app/llms.txt/route.ts +++ b/apps/docs/app/llms.txt/route.ts @@ -6,6 +6,9 @@ const baseUrl = "https://docs.dokploy.com"; export function GET() { const pages = source.getPages(); + const docsPages = pages.filter( + (page) => !page.url.startsWith("/docs/api/"), + ); const lines = [ "# Dokploy Documentation", @@ -14,14 +17,18 @@ export function GET() { "", "## Docs", "", - ...pages.map( + ...docsPages.map( (page) => `- [${page.data.title}](${baseUrl}${page.url})${page.data.description ? `: ${page.data.description}` : ""}`, ), "", + "## API Reference", + "", + `- [OpenAPI Specification](${baseUrl}/openapi.json): Complete API reference in OpenAPI format`, + "", "## Full Documentation", "", - `- [llms-full.txt](${baseUrl}/llms-full.txt)`, + `- [llms-full.txt](${baseUrl}/llms-full.txt): All documentation pages as plain text`, ]; return new Response(lines.join("\n"));