All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 1m58s
Build & Deploy / 🏗️ Build (push) Successful in 5m44s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🧪 Smoke Test (push) Successful in 48s
Build & Deploy / 🛡️ Quality Gates (push) Successful in 1m39s
Build & Deploy / ⚡ Lighthouse (push) Successful in 5m39s
Build & Deploy / ♿ WCAG (push) Successful in 5m35s
Build & Deploy / 🔔 Notify (push) Successful in 2s
30 lines
919 B
TypeScript
30 lines
919 B
TypeScript
import { ImageResponse } from 'next/og';
|
|
import { getTranslations } from 'next-intl/server';
|
|
import { OGImageTemplate } from '@/components/OGImageTemplate';
|
|
import { getOgFonts, 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: 'Products' });
|
|
const fonts = await getOgFonts();
|
|
|
|
const title = t.has('meta.title')
|
|
? t('meta.title')
|
|
: t.has('breadcrumb')
|
|
? t('breadcrumb')
|
|
: 'Products';
|
|
const description = t('meta.description') || t('subtitle');
|
|
|
|
return new ImageResponse(
|
|
<OGImageTemplate title={title} description={description} label="Products" />,
|
|
{
|
|
...OG_IMAGE_SIZE,
|
|
fonts,
|
|
},
|
|
);
|
|
}
|