portfolio/lib/generateMetadata.ts

29 lines
715 B
TypeScript
Raw Normal View History

2024-10-11 21:01:19 +00:00
type Meta = {
title: string
heading: string
description: string
type: string
[name: string]: string | Object
}
export const metadata = (meta: Meta) => {
return {
...meta,
openGraph: {
title: meta.title,
description: meta.description,
2024-10-21 21:16:43 +00:00
images: meta.images
? meta.images
: [
{
url: `/api/og-image?text=${meta.heading}`,
width: 1200,
height: 600,
alt: meta.heading,
type: 'image/png'
}
],
2024-10-11 21:01:19 +00:00
type: meta.type
}
}
}