import { Button } from '@/components/button' import { Container } from '@/components/container' import Content from '@/components/content' import { Footer } from '@/components/footer' import { GradientBackground } from '@/components/gradient' import { Navbar } from '@/components/navbar' import { fetchPostAuthors } from '@/components/post' import { Heading, Subheading } from '@/components/text' import { ChevronLeftIcon } from '@heroicons/react/16/solid' import { allPosts } from 'content-collections' import dayjs from 'dayjs' import { notFound } from 'next/navigation' export const generateStaticParams = async () => allPosts.map((post) => ({ slug: post._meta.path })) export const generateMetadata = async ({ params, }: { params: Promise<{ slug: string }> }) => { const aParams = await params const post = allPosts.find((post) => post._meta.path === aParams.slug) if (!post) notFound() return { title: post.title, description: post.excerpt } } export default async function BlogPost({ params, }: { params: Promise<{ slug: string }> }) { const aParams = await params const post = allPosts.find((post) => post._meta.path === aParams.slug) if (!post) notFound() const postAuthors = fetchPostAuthors() const author = post.author ? postAuthors[post.author] : undefined const tags = (post.tags ?? '').split(',').map((e) => e.trim()) return (
{dayjs(post.date).format('dddd, MMMM D, YYYY')} {post.title}
{author && (
{author.avatar && ( )}
{author.name}
)} {
{tags.map((tag) => (
{tag}
))}
}
{post.image && ( {post.title} )}
) }