Files
myeasycms-v2/apps/web/lib/root-metdata.ts
gbuomprisco b3d938144f Replace app name with title in root metadata
The root metadata in the application config now uses the title instead of the name both in the metadata base and openGraph sections. Adding title into OpenGraph can significantly improve SEO and make the app more discoverable on the internet.
2024-06-21 01:22:25 +08:00

39 lines
951 B
TypeScript

import { Metadata } from 'next';
import { headers } from 'next/headers';
import appConfig from '~/config/app.config';
/**
* @name generateRootMetadata
* @description Generates the root metadata for the application
*/
export const generateRootMetadata = (): Metadata => {
const csrfToken = headers().get('x-csrf-token') ?? '';
return {
title: appConfig.title,
description: appConfig.description,
metadataBase: new URL(appConfig.url),
applicationName: appConfig.name,
other: {
'csrf-token': csrfToken,
},
openGraph: {
url: appConfig.url,
siteName: appConfig.name,
title: appConfig.title,
description: appConfig.description,
},
twitter: {
card: 'summary_large_image',
title: appConfig.title,
description: appConfig.description,
},
icons: {
icon: '/images/favicon/favicon.ico',
apple: '/images/favicon/apple-touch-icon.png',
},
};
};