🚩 create HTML meta tag helper

This commit is contained in:
2025-08-05 13:17:04 +07:00
parent fcebe9708d
commit a2c9b7fd08
3 changed files with 43 additions and 0 deletions

29
shared/config/meta.ts Normal file
View File

@ -0,0 +1,29 @@
type BuildMeta = {
title?: string;
description?: string;
image?: string;
};
const appName = process.env.APP_NAME;
export const defaultMeta = {
title: appName || "Unknown App",
description: "Interactive community",
};
export const buildMeta = ({ title, description, image }: BuildMeta) => {
return {
title: title ? `${title} - ${appName}` : defaultMeta.title,
description: description || defaultMeta.description,
openGraph: {
title,
description,
images: image ? [image] : ["/default-og.png"],
},
twitter: {
card: "summary_large_image",
title,
description,
images: image ? [image] : ["/default-og.png"],
},
};
};