import { Box, Card, CardContent, CardMedia, Chip, Divider, Stack, Typography } from "@mui/material"; import { client } from "@/sanity/lib/client"; import PostContent from "@/components/posts/PostContent"; import Image from "next/image"; export async function generateMetadata({ params }: { params: { id: string } }) { const post = await client.fetch(`*[_type == "post" && slug.current == $slug][0] { title, description }`, { slug: params.id }); return { title: post.title, description: post.description }; } export default async function PostDetailPage({ params }: { params: { id: string } }) { const post = await client.fetch(`*[_type == "post" && slug.current == $slug][0] { title, description, slug, body, author, publishedAt, mainImage { asset -> { _id, url }, alt }, "categories": categories[]->title, "author_name": author->name, "author_image": author->image }`, { slug: params.id }); return ( { post.mainImage && {post.mainImage.alt} } {post.title} {post.categories.map((category: string, idx: number) => )} {post.description ?? "No description yet."} ); }