This commit is contained in:
2026-01-19 19:29:44 +01:00
parent 2feb73b982
commit 6797303628
15 changed files with 406 additions and 18 deletions

View File

@@ -34,30 +34,71 @@ export async function generateMetadata({ params }: ProductPageProps): Promise<Me
return {
title: categoryTitle,
description: categoryDesc,
alternates: {
canonical: `/${locale}/products/${productSlug}`,
languages: {
'de': `/de/products/${productSlug}`,
'en': `/en/products/${productSlug}`,
'x-default': `/en/products/${productSlug}`,
},
},
openGraph: {
title: categoryTitle,
title: `${categoryTitle} | KLZ Cables`,
description: categoryDesc,
url: `https://klz-cables.com/${locale}/products/${productSlug}`,
}
images: [
{
url: '/uploads/2025/02/og-2.webp',
width: 1200,
height: 630,
alt: categoryTitle,
},
],
},
twitter: {
card: 'summary_large_image',
title: `${categoryTitle} | KLZ Cables`,
description: categoryDesc,
images: ['/uploads/2025/02/og-2.webp'],
},
};
}
const product = await getProductBySlug(productSlug, locale);
if (!product) return {};
const imageUrl = product.frontmatter.images?.[0] || '/uploads/2025/02/og-2.webp';
return {
title: product.frontmatter.title,
description: product.frontmatter.description,
alternates: {
canonical: `/${locale}/products/${slug.join('/')}`,
languages: {
'de': `/de/products/${slug.join('/')}`,
'en': `/en/products/${slug.join('/')}`,
'x-default': `/en/products/${slug.join('/')}`,
},
},
openGraph: {
title: product.frontmatter.title,
title: `${product.frontmatter.title} | KLZ Cables`,
description: product.frontmatter.description,
type: 'website',
url: `https://klz-cables.com/${locale}/products/${slug.join('/')}`,
images: [
{
url: imageUrl,
width: 1200,
height: 630,
alt: product.frontmatter.title,
},
],
},
twitter: {
card: 'summary_large_image',
title: product.frontmatter.title,
title: `${product.frontmatter.title} | KLZ Cables`,
description: product.frontmatter.description,
images: [imageUrl],
},
};
}

View File

@@ -2,6 +2,8 @@ import Reveal from '@/components/Reveal';
import Scribble from '@/components/Scribble';
import { Badge, Button, Card, Container, Section } from '@/components/ui';
import { useTranslations } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import { Metadata } from 'next';
import Image from 'next/image';
import Link from 'next/link';
@@ -11,6 +13,41 @@ interface ProductsPageProps {
};
}
export async function generateMetadata({ params: { locale } }: ProductsPageProps): Promise<Metadata> {
const t = await getTranslations({ locale, namespace: 'Products' });
return {
title: t('title'),
description: t('subtitle'),
alternates: {
canonical: `/${locale}/products`,
languages: {
'de': '/de/products',
'en': '/en/products',
'x-default': '/en/products',
},
},
openGraph: {
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
url: `https://klz-cables.com/${locale}/products`,
images: [
{
url: '/uploads/2025/02/og-2.webp',
width: 1200,
height: 630,
alt: t('title'),
},
],
},
twitter: {
card: 'summary_large_image',
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
images: ['/uploads/2025/02/og-2.webp'],
},
};
}
export default function ProductsPage({ params }: ProductsPageProps) {
const t = useTranslations('Products');