// src/app/blog/[slug]/page.tsx import { getPostBySlug } from '@/lib/case-study'; import { notFound } from 'next/navigation'; import parse from 'html-react-parser'; interface StudyPageProps { params: Promise<{ slug: string }>; } export default async function BlogPostPage({ params }: StudyPageProps) { // In Next.js 15+, params is a Promise and must be awaited const { slug } = await params; const caseStudy = await getPostBySlug(slug); if (!caseStudy) { notFound(); // Triggers the closest 404 page if the file doesn't exist } return (

{caseStudy.title}

{/* Render the parsed HTML safely */}
{parse(caseStudy.contentHtml)}
); }