mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-28 08:49:38 +02:00
feat(docs-site): add agent-readable docs routes
This commit is contained in:
parent
b440c75092
commit
dfa4651ebc
6 changed files with 211 additions and 1 deletions
27
docs-site/app/llms.mdx/docs/[[...slug]]/route.ts
Normal file
27
docs-site/app/llms.mdx/docs/[[...slug]]/route.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import {
|
||||
getLlmDocsPage,
|
||||
getLlmDocsPages,
|
||||
getPageMarkdown,
|
||||
} from "@/lib/llm-docs";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export const dynamic = "force-static";
|
||||
|
||||
export async function GET(
|
||||
_request: Request,
|
||||
props: { params: Promise<{ slug?: string[] }> },
|
||||
) {
|
||||
const params = await props.params;
|
||||
const page = getLlmDocsPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return new Response(await getPageMarkdown(page), {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return getLlmDocsPages().map((page) => ({ slug: page.slug }));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue