import { ImageResponse } from 'next/og'; import { getPostBySlug } from '@/lib/blog'; export const runtime = 'nodejs'; export default async function Image({ params: { locale, slug } }: { params: { locale: string, slug: string } }) { const post = await getPostBySlug(slug, locale); if (!post) { return new ImageResponse(
); } return new ImageResponse( (
{/* Background Image Overlay if available */} {post.frontmatter.featuredImage && ( )} {/* Gradient Overlay */}
{post.frontmatter.category && (
{post.frontmatter.category}
)}
{post.frontmatter.title}
KLZ Cables Blog
{new Date(post.frontmatter.date).toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' })}
), { width: 1200, height: 630, } ); }