mirror of
https://github.com/fosrl/docs-v2.git
synced 2026-10-08 21:59:54 +02:00
port mintlify to fumadocs
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { docsLlms, source } from '@/lib/source';
|
||||
import { getPageMarkdownUrl } from '@/lib/shared';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(_req: Request, { params }: RouteContext<'/llms.mdx/[[...slug]]'>) {
|
||||
const { slug } = await params;
|
||||
// last segment is always `content.md`
|
||||
const page = source.getPage(slug?.slice(0, -1));
|
||||
if (!page) notFound();
|
||||
|
||||
return new Response(await docsLlms.page(page), {
|
||||
headers: {
|
||||
'Content-Type': 'text/markdown; charset=utf-8',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return source.getPages().map((page) => ({
|
||||
slug: getPageMarkdownUrl(page).segments,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user