2026-08-16 00:54:15 +02:00
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
|
|
|
|
import type { Metadata } from "next";
|
|
|
|
|
import Link from "next/link";
|
|
|
|
|
import { notFound } from "next/navigation";
|
|
|
|
|
import { ArrowLeft } from "lucide-react";
|
|
|
|
|
import { getDocMeta, readDocContent } from "@/lib/docs";
|
|
|
|
|
import { MarkdownViewer } from "@/components/docs/markdown-viewer";
|
|
|
|
|
|
|
|
|
|
interface DocPageProps {
|
|
|
|
|
params: Promise<{ slug: string }>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function generateMetadata({
|
|
|
|
|
params,
|
|
|
|
|
}: DocPageProps): Promise<Metadata> {
|
|
|
|
|
const { slug } = await params;
|
|
|
|
|
return { title: getDocMeta(slug)?.title ?? "Doc not found" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default async function DocPage({ params }: DocPageProps) {
|
|
|
|
|
const { slug } = await params;
|
|
|
|
|
const doc = getDocMeta(slug);
|
|
|
|
|
if (!doc) notFound();
|
|
|
|
|
|
|
|
|
|
const content = readDocContent(doc);
|
|
|
|
|
if (content === null) notFound();
|
|
|
|
|
|
|
|
|
|
return (
|
2026-08-17 09:57:19 +02:00
|
|
|
<div className="mx-auto flex max-w-5xl flex-col gap-6">
|
2026-08-16 00:54:15 +02:00
|
|
|
<Link
|
|
|
|
|
href="/docs"
|
|
|
|
|
className="text-muted-foreground hover:text-foreground flex w-fit items-center gap-1 text-sm"
|
|
|
|
|
>
|
|
|
|
|
<ArrowLeft className="size-3.5" />
|
|
|
|
|
All docs
|
|
|
|
|
</Link>
|
|
|
|
|
<MarkdownViewer content={content} />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|