titles
Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-01-27 00:07:00 +01:00
parent b8fdbfb10b
commit a805c7b8de
6 changed files with 53 additions and 23 deletions

View File

@@ -23,9 +23,11 @@ interface ContactPageProps {
export async function generateMetadata({ params: { locale } }: ContactPageProps): Promise<Metadata> {
const t = await getTranslations({ locale, namespace: 'Contact' });
const title = t('meta.title') || t('title');
const description = t('meta.description') || t('subtitle');
return {
title: t('title'),
description: t('subtitle'),
title,
description,
alternates: {
canonical: `https://klz-cables.com/${locale}/contact`,
languages: {
@@ -34,8 +36,8 @@ export async function generateMetadata({ params: { locale } }: ContactPageProps)
},
},
openGraph: {
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
title: `${title} | KLZ Cables`,
description,
url: `https://klz-cables.com/${locale}/contact`,
siteName: 'KLZ Cables',
images: [
@@ -51,8 +53,8 @@ export async function generateMetadata({ params: { locale } }: ContactPageProps)
},
twitter: {
card: 'summary_large_image',
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
title: `${title} | KLZ Cables`,
description,
images: ['https://klz-cables.com/logo.png'],
},
robots: {

View File

@@ -38,22 +38,22 @@ export default function HomePage({ params: { locale } }: { params: { locale: str
}
export async function generateMetadata({ params: { locale } }: { params: { locale: string } }): Promise<Metadata> {
// Use translations for meta where available (namespace: Home.meta)
// Use translations for meta where available (namespace: Index.meta)
// Fallback to a sensible default if translation keys are missing.
let t;
try {
t = await getTranslations({ locale, namespace: 'Home.meta' });
t = await getTranslations({ locale, namespace: 'Index.meta' });
} catch (err) {
// If translations for Home.meta are not present, try generic Home namespace
// If translations for Index.meta are not present, try generic Index namespace
try {
t = await getTranslations({ locale, namespace: 'Home' });
t = await getTranslations({ locale, namespace: 'Index' });
} catch (e) {
t = (key: string) => '';
}
}
const title = t('title') || 'KLZ Cables';
const description = t('description') || t('subtitle') || '';
const description = t('description') || '';
return {
title,

View File

@@ -15,9 +15,11 @@ interface ProductsPageProps {
export async function generateMetadata({ params: { locale } }: ProductsPageProps): Promise<Metadata> {
const t = await getTranslations({ locale, namespace: 'Products' });
const title = t('meta.title') || t('title');
const description = t('meta.description') || t('subtitle');
return {
title: t('title'),
description: t('subtitle'),
title,
description,
alternates: {
canonical: `/${locale}/products`,
languages: {
@@ -27,14 +29,14 @@ export async function generateMetadata({ params: { locale } }: ProductsPageProps
},
},
openGraph: {
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
title: `${title} | KLZ Cables`,
description,
url: `https://klz-cables.com/${locale}/products`,
},
twitter: {
card: 'summary_large_image',
title: `${t('title')} | KLZ Cables`,
description: t('subtitle'),
title: `${title} | KLZ Cables`,
description,
},
};
}

View File

@@ -15,9 +15,11 @@ interface TeamPageProps {
export async function generateMetadata({ params: { locale } }: TeamPageProps): Promise<Metadata> {
const t = await getTranslations({ locale, namespace: 'Team' });
const title = t('meta.title') || t('hero.subtitle');
const description = t('meta.description') || t('hero.title');
return {
title: t('hero.subtitle'),
description: t('hero.title'),
title,
description,
alternates: {
canonical: `/${locale}/team`,
languages: {
@@ -27,14 +29,14 @@ export async function generateMetadata({ params: { locale } }: TeamPageProps): P
},
},
openGraph: {
title: `${t('hero.subtitle')} | KLZ Cables`,
description: t('hero.title'),
title: `${title} | KLZ Cables`,
description,
url: `https://klz-cables.com/${locale}/team`,
},
twitter: {
card: 'summary_large_image',
title: `${t('hero.subtitle')} | KLZ Cables`,
description: t('hero.title'),
title: `${title} | KLZ Cables`,
description,
},
};
}