import Link from "next/link"; import { notFound } from "next/navigation"; import { getDocument, listDocuments, getRelated } from "@mcpedia/core"; import Markdown from "@/components/Markdown"; export default async function DocPage({ params, }: { params: Promise<{ section: string; slug: string[] }>; }) { const { section, slug } = await params; const fullSlug = `${section}/${slug.join("/")}`; const doc = await getDocument(fullSlug); if (!doc) notFound(); const related = await getRelated(fullSlug, 5); return (
← Back

{doc.title}

{doc.tags.map((t) => `#${t}`).join(" ")} · {doc.author || "unknown"}
{related.length > 0 && ( )}
); } export async function generateStaticParams() { const docs = await listDocuments(); return docs.map((d) => ({ section: d.section, slug: d.slug.split("/").slice(1), })); }