Files
2025-12-27 21:16:53 -08:00

35 lines
730 B
TypeScript

import type { Metadata } from "next";
export const getMetadata = ({
title,
description,
imageRelativePath = "/thumbnail.jpg",
}: {
title: string;
description: string;
imageRelativePath?: string;
}): Metadata => {
const baseUrl = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: `http://localhost:${process.env.PORT || 3000}`;
const imageUrl = `${baseUrl}${imageRelativePath}`;
return {
title: title,
description: description,
openGraph: {
title: title,
description: description,
images: [
{
url: imageUrl,
},
],
},
twitter: {
title: title,
description: description,
images: [imageUrl],
},
};
};