import Link from 'next/link'; import { getAllPosts } from '@/lib/blog'; import { getTranslations } from 'next-intl/server'; interface BlogIndexProps { params: { locale: string; }; } export async function generateMetadata({ params: { locale } }: BlogIndexProps) { const t = await getTranslations({ locale, namespace: 'blog' }); return { title: locale === 'de' ? 'Neuigkeiten zu Kabeln und Energielösungen' : 'News on Cables and Energy Solutions', description: locale === 'de' ? 'Bleiben Sie auf dem Laufenden! Lesen Sie aktuelle Themen und Insights zu Kabeltechnologie, Energielösungen und branchenspezifischen Innovationen.' : 'Stay up to date! Read current topics and insights on cable technology, energy solutions and industry-specific innovations.', }; } export default async function BlogIndex({ params: { locale } }: BlogIndexProps) { const posts = await getAllPosts(locale); const t = await getTranslations({ locale, namespace: 'blog' }); // Get unique categories const categories = Array.from(new Set(posts.map(post => post.frontmatter.category).filter(Boolean))); return (

{locale === 'de' ? 'Neuigkeiten zu Kabeln und Energielösungen' : 'News on Cables and Energy Solutions'}

{locale === 'de' ? 'Bleiben Sie auf dem Laufenden! Lesen Sie aktuelle Themen und Insights zu Kabeltechnologie, Energielösungen und branchenspezifischen Innovationen.' : 'Stay up to date! Read current topics and insights on cable technology, energy solutions and industry-specific innovations.'}

{/* Category filter - could be made interactive with client component */} {categories.length > 0 && (
{categories.map((category) => ( {category} ))}
)} {/* Masonry-style grid */}
{posts.map((post) => (
{post.frontmatter.featuredImage && (
{post.frontmatter.title} {post.frontmatter.category && ( {post.frontmatter.category} )}
)}
{new Date(post.frontmatter.date).toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' })}

{post.frontmatter.title}

{post.frontmatter.excerpt && (

{post.frontmatter.excerpt}

)} {locale === 'de' ? 'Weiterlesen' : 'Read more'} →
))}
); }