mirror of
https://github.com/Dokploy/website.git
synced 2026-06-15 20:25:25 +02:00
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.
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user