import { notFound } from 'next/navigation' import Link from 'next/link' import { getPosts, getPost, tagToSlug } from '@/lib/posts' import { TableOfContents } from '@/components/posts/TableOfContents' import { ScrollToTop } from '@/components/ui/ScrollToTop' import { ReadingProgress } from '@/components/ui/ReadingProgress' export const dynamicParams = false export const dynamic = 'force-static' export async function generateStaticParams() { const posts = await getPosts() return posts.map((post) => ({ slug: post.slug })) } export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }) { const slug = (await params).slug const post = await getPost(slug) if (!post) return { title: 'Not Found' } return { title: post.title } } export default async function PostPage({ params }: { params: Promise<{ slug: string }> }) { const slug = (await params).slug const post = await getPost(slug) if (!post) notFound() const { default: PostContent } = await import( /* turbopackOptional: true */ `@/content/posts/${slug}.mdx` ) return ( <>

{post.title}

{post.author && by {post.author}} {post.readingTime} min read
{post.coverImage && ( {`Featured )} {post.tags.length > 0 && (
{post.tags.map((tag) => ( {tag} ))}
)}
) }