import Link from 'next/link'; import { getAllPosts } from '@/lib/blog'; import { Section, Container, Heading, Card, Badge, Button } from '@/components/ui'; import Reveal from '@/components/Reveal'; interface BlogIndexProps { params: { locale: string; }; } export async function generateMetadata({ params: { locale } }: BlogIndexProps) { 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); // Sort posts by date descending const sortedPosts = [...posts].sort((a, b) => new Date(b.frontmatter.date).getTime() - new Date(a.frontmatter.date).getTime() ); const featuredPost = sortedPosts[0]; const remainingPosts = sortedPosts.slice(1); return (
{/* Hero Section - Immersive Magazine Feel */}
{featuredPost && featuredPost.frontmatter.featuredImage && ( <> {featuredPost.frontmatter.title}
)}
Featured Post {featuredPost && ( <>

{featuredPost.frontmatter.title}

{featuredPost.frontmatter.excerpt}

)}
{locale === 'de' ? 'Alle Beiträge' : 'All Articles'}
{/* Category filters could go here */} All Industry Technical Sustainability
{/* Grid for remaining posts */}
{remainingPosts.map((post, idx) => ( {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}

{locale === 'de' ? 'Weiterlesen' : 'Read more'}
))}
{/* Pagination Placeholder */}
); }