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'; 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.meta' }); return { title: t('title'), description: t('description'), alternates: { canonical: `/${locale}/blog`, languages: { 'de': '/de/blog', 'en': '/en/blog', 'x-default': '/en/blog', }, }, openGraph: { title: `${t('title')} | KLZ Cables`, description: t('description'), url: `https://klz-cables.com/${locale}/blog`, }, twitter: { card: 'summary_large_image', title: `${t('title')} | KLZ Cables`, description: t('description'), }, }; } export default async function BlogIndex({ params: { locale } }: BlogIndexProps) { const t = await getTranslations('Blog'); 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 (
{featuredPost.frontmatter.excerpt}
> )}{post.frontmatter.excerpt}