portfolio/lib/generateMetadata.ts

31 lines
705 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
}
2024-10-12 21:10:18 +00:00
export const metadata = (meta: Meta) => {
2024-10-11 21:01:19 +00:00
return {
...meta,
openGraph: {
title: meta.title,
description: meta.description,
images: [
{
url: `/api/og-image?text=${meta.heading}`,
width: 1200,
height: 600,
alt: meta.heading,
type: 'image/png'
}
],
type: meta.type
}
}
2024-10-12 21:10:18 +00:00
}
export async function generateMetadata(meta: Meta) {
return metadata(meta)
2024-10-11 21:01:19 +00:00
}