import { notFound } from 'next/navigation' import { CustomMDX } from '@/components/Mdx' import { formatDate, getBlogPosts } from '@/blog/utils' import { baseUrl } from '@/app/sitemap' export async function generateStaticParams() { let posts = getBlogPosts() return posts.map((post) => ({ slug: post.slug, })) } export function generateMetadata({ params }) { let post = getBlogPosts().find((post) => post.slug === params.slug) if (!post) { return } let { title, publishedAt: publishedTime, summary: description, image, } = post.metadata let ogImage = image ? image : `${baseUrl}/og?title=${encodeURIComponent(title)}` return { title, description, openGraph: { title, description, type: 'article', publishedTime, url: `${baseUrl}/blog/${post.slug}`, images: [ { url: ogImage, }, ], }, twitter: { card: 'summary_large_image', title, description, images: [ogImage], }, } } export default function Blog({ params }) { let post = getBlogPosts().find((post) => post.slug === params.slug) if (!post) { notFound() } return (