import { notFound } from 'next/navigation'; import { NEWS, COMPANY_INFO } from '@/lib/constants'; import { NewsDetailClient } from './NewsDetailClient'; export async function generateStaticParams() { return NEWS.map((news) => ({ slug: news.id, })); } export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const news = NEWS.find((n) => n.id === slug); if (!news) { return { title: '新闻未找到', }; } return { title: `${news.title} - ${COMPANY_INFO.displayName}`, description: news.excerpt, }; } export default async function NewsDetailPage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const news = NEWS.find((n) => n.id === slug); if (!news) { notFound(); } const serializedNews = JSON.parse(JSON.stringify(news)); return ; }