import { notFound } from 'next/navigation'; import JsonLd from '@/components/JsonLd'; import { SITE_URL } from '@/lib/schema'; import { MDXRemote } from 'next-mdx-remote/rsc'; import { getPostBySlug, getAdjacentPosts, getReadingTime, getHeadings } from '@/lib/blog'; import { Metadata } from 'next'; import Link from 'next/link'; import PostNavigation from '@/components/blog/PostNavigation'; import PowerCTA from '@/components/blog/PowerCTA'; import TableOfContents from '@/components/blog/TableOfContents'; import { mdxComponents } from '@/components/blog/MDXComponents'; import { Heading } from '@/components/ui'; import { getOGImageMetadata } from '@/lib/metadata'; import { setRequestLocale } from 'next-intl/server'; interface BlogPostProps { params: Promise<{ locale: string; slug: string; }>; } export async function generateMetadata({ params }: BlogPostProps): Promise { const { locale, slug } = await params; const post = await getPostBySlug(slug, locale); if (!post) return {}; const description = post.frontmatter.excerpt || ''; return { title: post.frontmatter.title, description: description, alternates: { canonical: `/${locale}/blog/${slug}`, languages: { de: `/de/blog/${slug}`, en: `/en/blog/${slug}`, 'x-default': `/en/blog/${slug}`, }, }, openGraph: { title: `${post.frontmatter.title} | KLZ Cables`, description: description, type: 'article', publishedTime: post.frontmatter.date, authors: ['KLZ Cables'], url: `${SITE_URL}/${locale}/blog/${slug}`, images: getOGImageMetadata(`blog/${slug}`, post.frontmatter.title, locale), }, twitter: { card: 'summary_large_image', title: `${post.frontmatter.title} | KLZ Cables`, description: description, }, }; } export default async function BlogPost({ params }: BlogPostProps) { const { locale, slug } = await params; setRequestLocale(locale); const post = await getPostBySlug(slug, locale); const { prev, next } = await getAdjacentPosts(slug, locale); if (!post) { notFound(); } const headings = getHeadings(post.content); return (
{/* Featured Image Header */} {post.frontmatter.featuredImage ? (
{/* Title overlay on image */}
{post.frontmatter.category && (
{post.frontmatter.category}
)} {post.frontmatter.title}
{getReadingTime(post.content)} min read
) : (
{post.frontmatter.category && (
{post.frontmatter.category}
)} {post.frontmatter.title}
{getReadingTime(post.content)} min read
)} {/* Main Content Area with Sticky Narrative Layout */}
{/* Left Column: Content */}
{/* Excerpt/Lead paragraph if available */} {post.frontmatter.excerpt && (

{post.frontmatter.excerpt}

)} {/* Main content with enhanced styling */}
{/* Power CTA */}
{/* Post Navigation */}
{/* Back to blog link */}
{locale === 'de' ? 'Zurück zur Übersicht' : 'Back to Overview'}
{/* Right Column: Sticky Sidebar */}
{/* Structured Data */}
); }