61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { Metadata } from 'next';
|
|
import { setRequestLocale } from 'next-intl/server';
|
|
import { notFound } from 'next/navigation';
|
|
import { getMdxContent } from '@/lib/mdx';
|
|
import { MDXRemote } from 'next-mdx-remote/rsc';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
// Import components used in MDX
|
|
import { HeroVideo as HomeHero } from '@/components/blocks/HeroVideo';
|
|
import { SubCompanyTiles as HomeSubCompanyTiles } from '@/components/blocks/SubCompanyTiles';
|
|
import { CompetenceBentoGrid as HomeCompetenceBentoGrid } from '@/components/blocks/CompetenceBentoGrid';
|
|
import { ReferencesSlider as HomeReferencesSlider } from '@/components/blocks/ReferencesSlider';
|
|
|
|
import { Button } from '@/components/ui/Button';
|
|
import { Heading } from '@/components/ui/Heading';
|
|
|
|
const mdxComponents = {
|
|
HomeHero,
|
|
HomeSubCompanyTiles,
|
|
HomeCompetenceBentoGrid,
|
|
HomeReferencesSlider,
|
|
Button,
|
|
Heading,
|
|
};
|
|
|
|
export async function generateMetadata(props: any): Promise<Metadata> {
|
|
const { locale } = await props.params;
|
|
if (locale !== 'de' && locale !== 'en') return {};
|
|
|
|
const mdx = await getMdxContent(locale, 'home');
|
|
|
|
return {
|
|
title: mdx?.frontmatter?.title || (locale === 'de' ? 'Startseite' : 'Home'),
|
|
description: mdx?.frontmatter?.description,
|
|
};
|
|
}
|
|
|
|
export default async function Home(props: any) {
|
|
const { locale } = await props.params;
|
|
|
|
if (locale !== 'de' && locale !== 'en') {
|
|
notFound();
|
|
}
|
|
|
|
setRequestLocale(locale);
|
|
|
|
const mdx = await getMdxContent(locale, 'home');
|
|
|
|
if (!mdx) {
|
|
notFound();
|
|
}
|
|
|
|
return (
|
|
<main>
|
|
<MDXRemote source={mdx.content} components={mdxComponents} />
|
|
</main>
|
|
);
|
|
}
|
|
|