added case-study slug framework
All checks were successful
Build and Deploy NextJS SculptedArc Website / build-and-deploy (push) Successful in 1m10s

This commit is contained in:
2026-06-22 19:24:13 +01:00
parent ef8d90651e
commit ea12adf484
7 changed files with 814 additions and 38 deletions

View File

@@ -0,0 +1,32 @@
// 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 (
<article className="max-w-2xl mx-auto py-10 px-4">
<header className="mb-8">
<h1 className="text-4xl font-bold mb-2">{caseStudy.title}</h1>
</header>
{/* Render the parsed HTML safely */}
<div className="prose dark:prose-invert">
{parse(caseStudy.contentHtml)}
</div>
</article>
);
}