import Link from "next/link";
import { notFound } from "next/navigation";
import { getAllPages, getPageBySlug, type WikiPage as WikiPageType } from "@/lib/wiki";
import { Sidebar } from "@/components/Sidebar";
export async function generateStaticParams() {
const pages = await getAllPages();
return pages.map((page) => ({
slug: page.slug,
}));
}
export default async function WikiPageComponent({
params,
}: {
params: Promise<{ slug: string }>;
}) {
const { slug } = await params;
const page = await getPageBySlug(slug);
if (!page) {
notFound();
}
const allPages = await getAllPages();
return (
{/* Header */}
{/* Sidebar */}
{/* Main content */}
{/* Page header */}
{page.title}
{page.frontmatter.last_updated && (
最后更新: {String(page.frontmatter.last_updated)}
)}
{page.frontmatter.tags && page.frontmatter.tags.length > 0 && (
{page.frontmatter.tags.map((tag: string) => (
{tag}
))}
)}
{/* Page content */}
);
}