portfolio/lib/generateMetadata.ts
Ryan Freeman de968c4ed9
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m45s
Add og meta tags to pages
2024-10-11 22:01:19 +01:00

27 lines
634 B
TypeScript

type Meta = {
title: string
heading: string
description: string
type: string
[name: string]: string | Object
}
export async function generateMetadata(meta: Meta) {
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
}
}
}