docs: Improve docs with core-concept and guides
This commit is contained in:
@@ -4,6 +4,7 @@ import {notFound} from 'next/navigation';
|
||||
|
||||
import {source} from '@/lib/source';
|
||||
import {getMDXComponents} from '@/mdx-components';
|
||||
import {LLMCopyButton, ViewOptions} from '@/components/page-actions';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@@ -18,6 +19,15 @@ export default async function Page(props: {params: Promise<{slug?: string[]}>})
|
||||
<DocsPage toc={page.data.toc} full={page.data.full}>
|
||||
<DocsTitle>{page.data.title}</DocsTitle>
|
||||
<DocsDescription>{page.data.description}</DocsDescription>
|
||||
|
||||
<div className="flex flex-row gap-2 items-center border-b pt-2 pb-6">
|
||||
<LLMCopyButton markdownUrl={`/llms.mdx${page.url}`} />
|
||||
<ViewOptions
|
||||
markdownUrl={`/llms.mdx${page.url}`}
|
||||
githubUrl={`https://github.com/useplunk/plunk/blob/next/apps/wiki/content/docs/${page.path}`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DocsBody>
|
||||
<MDXContent
|
||||
components={getMDXComponents({
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import {getLLMText} from '@/lib/get-llm-text';
|
||||
import {source} from '@/lib/source';
|
||||
import {notFound} from 'next/navigation';
|
||||
|
||||
export const revalidate = false;
|
||||
|
||||
export async function GET(
|
||||
_req: Request,
|
||||
props: {params: Promise<{slug?: string[]}>},
|
||||
) {
|
||||
const params = await props.params;
|
||||
const page = source.getPage(params.slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return new Response(await getLLMText(page), {
|
||||
headers: {
|
||||
'Content-Type': 'text/markdown',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
return source.generateParams();
|
||||
}
|
||||
Reference in New Issue
Block a user