import Link from "next/link"; import { notFound } from "next/navigation"; import { getDocument, listDocuments, getRelated, listRevisions } from "@mcpedia/core"; import Markdown from "@/components/Markdown"; // Render at request time. The content lives in Postgres (populated by the // indexer/worker), which is not available at build time (CI has no DB), so we // opt out of static generation. At this corpus scale request-time rendering is // instant. export const dynamic = "force-dynamic"; 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); const revisions = await listRevisions(fullSlug, 10); return (
← Back

{doc.title}

{doc.tags.map((t) => `#${t}`).join(" ")} · {doc.author || "unknown"}
{related.length > 0 && ( )} {revisions.length > 0 && ( )}
); }