import type { Metadata } from "next"; import Link from "next/link"; import { notFound } from "next/navigation"; import { ChevronRight } from "lucide-react"; import { fetchSitePageBySlug } from "@/lib/api"; import { formatDate } from "@/lib/format"; import MarkdownBody from "@/components/MarkdownBody"; interface PageProps { params: Promise<{ slug: string }>; } export async function generateMetadata({ params }: PageProps): Promise { const { slug } = await params; const data = await fetchSitePageBySlug(slug).catch(() => null); if (!data) return { title: "页面不存在" }; const p = data.page; return { title: p.title, description: p.excerpt || p.title, openGraph: { title: p.title, description: p.excerpt || p.title, type: "article", publishedTime: p.created_at, }, }; } export default async function SitePagePublic({ params }: PageProps) { const { slug } = await params; const data = await fetchSitePageBySlug(slug).catch(() => null); if (!data) notFound(); const p = data.page; const jsonLd = { "@context": "https://schema.org", "@type": "Article", headline: p.title, description: p.excerpt || undefined, datePublished: p.created_at, dateModified: p.updated_at, }; return (