mirror of
https://github.com/luxfhe/example-rps-game.git
synced 2026-10-30 18:13:18 +00:00
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import type { Metadata } from "next";
|
|
|
|
const baseUrl = process.env.VERCEL_PROJECT_PRODUCTION_URL
|
|
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
|
: `http://localhost:${process.env.PORT || 3000}`;
|
|
const titleTemplate = "%s | Scaffold-ETH 2";
|
|
|
|
export const getMetadata = ({
|
|
title,
|
|
description,
|
|
imageRelativePath = "/thumbnail.jpg",
|
|
}: {
|
|
title: string;
|
|
description: string;
|
|
imageRelativePath?: string;
|
|
}): Metadata => {
|
|
const imageUrl = `${baseUrl}${imageRelativePath}`;
|
|
|
|
return {
|
|
metadataBase: new URL(baseUrl),
|
|
title: {
|
|
default: title,
|
|
template: titleTemplate,
|
|
},
|
|
description: description,
|
|
openGraph: {
|
|
title: {
|
|
default: title,
|
|
template: titleTemplate,
|
|
},
|
|
description: description,
|
|
images: [
|
|
{
|
|
url: imageUrl,
|
|
},
|
|
],
|
|
},
|
|
twitter: {
|
|
title: {
|
|
default: title,
|
|
template: titleTemplate,
|
|
},
|
|
description: description,
|
|
images: [imageUrl],
|
|
},
|
|
icons: {
|
|
icon: [{ url: "/favicon.png", sizes: "32x32", type: "image/png" }],
|
|
},
|
|
};
|
|
};
|