36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import { ImageResponse } from 'next/og';
|
|
import { getTranslations } from 'next-intl/server';
|
|
import { OGImageTemplate } from '@/components/OGImageTemplate';
|
|
import { getOgFonts, getOgBackground, getOgLogo, OG_IMAGE_SIZE } from '@/lib/og-helper';
|
|
|
|
export const size = OG_IMAGE_SIZE;
|
|
export const contentType = 'image/png';
|
|
export const runtime = 'nodejs';
|
|
|
|
export default async function Image({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params;
|
|
const t = await getTranslations({ locale, namespace: 'Contact' });
|
|
const fonts = await getOgFonts();
|
|
const bg = getOgBackground();
|
|
const logo = getOgLogo();
|
|
|
|
let title = t('meta.title') || t('title');
|
|
if (title.startsWith('E-TIB GmbH | ')) {
|
|
title = title.substring('E-TIB GmbH | '.length);
|
|
}
|
|
|
|
return new ImageResponse(
|
|
<OGImageTemplate
|
|
title="Die Experten für Kabelnetzbau"
|
|
description={title}
|
|
label="Contact"
|
|
image={bg}
|
|
logo={logo}
|
|
/>,
|
|
{
|
|
...OG_IMAGE_SIZE,
|
|
fonts,
|
|
},
|
|
);
|
|
}
|