Some checks failed
Build & Deploy KLZ Cables / build-and-deploy (push) Failing after 13s
30 lines
768 B
TypeScript
30 lines
768 B
TypeScript
import { ImageResponse } from 'next/og';
|
|
import { getPageBySlug } from '@/lib/pages';
|
|
import { OGImageTemplate } from '@/components/OGImageTemplate';
|
|
|
|
export const runtime = 'nodejs';
|
|
|
|
export default async function Image({ params: { locale, slug } }: { params: { locale: string, slug: string } }) {
|
|
const pageData = await getPageBySlug(slug, locale);
|
|
|
|
if (!pageData) {
|
|
return new ImageResponse(
|
|
<div style={{ display: 'flex', width: '100%', height: '100%', backgroundColor: '#001a4d' }} />
|
|
);
|
|
}
|
|
|
|
return new ImageResponse(
|
|
(
|
|
<OGImageTemplate
|
|
title={pageData.frontmatter.title}
|
|
description={pageData.frontmatter.excerpt}
|
|
label="Information"
|
|
/>
|
|
),
|
|
{
|
|
width: 1200,
|
|
height: 630,
|
|
}
|
|
);
|
|
}
|