Files
klz-cables.com/app/[locale]/page.tsx

109 lines
2.8 KiB
TypeScript

import Hero from '@/components/home/Hero';
import JsonLd from '@/components/JsonLd';
import { getBreadcrumbSchema, SITE_URL } from '@/lib/schema';
import ProductCategories from '@/components/home/ProductCategories';
import WhatWeDo from '@/components/home/WhatWeDo';
import RecentPosts from '@/components/home/RecentPosts';
import Experience from '@/components/home/Experience';
import WhyChooseUs from '@/components/home/WhyChooseUs';
import MeetTheTeam from '@/components/home/MeetTheTeam';
import GallerySection from '@/components/home/GallerySection';
import VideoSection from '@/components/home/VideoSection';
import CTA from '@/components/home/CTA';
import Reveal from '@/components/Reveal';
import { getTranslations } from 'next-intl/server';
import { Metadata } from 'next';
import { getOGImageMetadata } from '@/lib/metadata';
export default async function HomePage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
return (
<div className="flex flex-col min-h-screen">
<JsonLd
id="breadcrumb-home"
data={getBreadcrumbSchema([{ name: 'Home', item: `/${locale}` }])}
/>
<Hero />
<Reveal>
<ProductCategories />
</Reveal>
<Reveal>
<WhatWeDo />
</Reveal>
<Reveal>
<RecentPosts locale={locale} />
</Reveal>
<Reveal>
<Experience />
</Reveal>
<Reveal>
<WhyChooseUs />
</Reveal>
<Reveal>
<MeetTheTeam />
</Reveal>
<Reveal>
<GallerySection />
</Reveal>
<Reveal>
<VideoSection />
</Reveal>
<Reveal>
<CTA />
</Reveal>
</div>
);
}
export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
const { locale } = await params;
// 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: 'Index.meta' });
} catch (err) {
// If translations for Index.meta are not present, try generic Index namespace
try {
t = await getTranslations({ locale, namespace: 'Index' });
} catch (e) {
t = (key: string) => '';
}
}
const title = t('title') || 'KLZ Cables';
const description = t('description') || '';
return {
title,
description,
alternates: {
canonical: `/${locale}`,
languages: {
de: '/de',
en: '/en',
'x-default': '/en',
},
},
openGraph: {
title: `${title} | KLZ Cables`,
description,
url: `${SITE_URL}/${locale}`,
images: getOGImageMetadata('', title, locale),
},
twitter: {
card: 'summary_large_image',
title: `${title} | KLZ Cables`,
description,
},
};
}