import { notFound } from 'next/navigation'; import { MDXRemote } from 'next-mdx-remote/rsc'; import { getPostBySlug, getAdjacentPosts } from '@/lib/blog'; import { Metadata } from 'next'; interface BlogPostProps { params: { locale: string; slug: string; }; } export async function generateMetadata({ params: { locale, slug } }: BlogPostProps): Promise { const post = await getPostBySlug(slug, locale); if (!post) return {}; const description = post.frontmatter.excerpt || ''; return { title: post.frontmatter.title, description: description, openGraph: { title: post.frontmatter.title, description: description, type: 'article', publishedTime: post.frontmatter.date, authors: ['KLZ Cables'], url: `https://klz-cables.com/${locale}/blog/${slug}`, }, twitter: { card: 'summary_large_image', title: post.frontmatter.title, description: description, }, }; } import Link from 'next/link'; import VisualLinkPreview from '@/components/blog/VisualLinkPreview'; import { Callout } from '@/components/ui'; import HighlightBox from '@/components/blog/HighlightBox'; import Stats from '@/components/blog/Stats'; import AnimatedImage from '@/components/blog/AnimatedImage'; import ChatBubble from '@/components/blog/ChatBubble'; import SplitHeading from '@/components/blog/SplitHeading'; import PostNavigation from '@/components/blog/PostNavigation'; import PowerCTA from '@/components/blog/PowerCTA'; import ShareButton from '@/components/blog/ShareButton'; const components = { VisualLinkPreview, Callout, HighlightBox, Stats, AnimatedImage, ChatBubble, PowerCTA, SplitHeading, a: ({ href, children, ...props }: any) => { if (href?.startsWith('/')) { return ( {children} ); } return ( {children} ); }, img: (props: any) => ( ), h2: ({ children, ...props }: any) => ( {children} ), h3: ({ children, ...props }: any) => (

{children}

), p: ({ children, ...props }: any) => (

{children}

), ul: ({ children, ...props }: any) => ( ), ol: ({ children, ...props }: any) => (
    {children}
), li: ({ children, ...props }: any) => (
  • {children}
  • ), blockquote: ({ children, ...props }: any) => (
    {children}
    ), strong: ({ children, ...props }: any) => ( {children} ), code: ({ children, ...props }: any) => ( {children} ), pre: ({ children, ...props }: any) => (
          {children}
        
    ), table: ({ children, ...props }: any) => (
    {children}
    ), thead: ({ children, ...props }: any) => ( {children} ), tbody: ({ children, ...props }: any) => ( {children} ), tr: ({ children, ...props }: any) => ( {children} ), th: ({ children, ...props }: any) => ( {children} ), td: ({ children, ...props }: any) => ( {children} ), }; export default async function BlogPost({ params: { locale, slug } }: BlogPostProps) { const post = await getPostBySlug(slug, locale); const { prev, next } = await getAdjacentPosts(slug, locale); if (!post) { notFound(); } return (
    {/* Featured Image Header */} {post.frontmatter.featuredImage && (
    {/* Title overlay on image */}
    {post.frontmatter.category && ( {post.frontmatter.category} )}

    {post.frontmatter.title}

    KLZ Cables
    )} {/* Content */}
    {/* Mobile Share Button */}
    {/* If no featured image, show header here */} {!post.frontmatter.featuredImage && (
    {post.frontmatter.category && (
    {post.frontmatter.category}
    )}

    {post.frontmatter.title}

    KLZ Cables
    )} {/* Excerpt/Lead paragraph if available */} {post.frontmatter.excerpt && (

    {post.frontmatter.excerpt}

    )} {/* Main content with enhanced styling */}
    {/* Structured Data */}