40 lines
1006 B
TypeScript
40 lines
1006 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 = async (): Promise<Metadata> => {
|
|
const headersStore = await headers();
|
|
const csrfToken = headersStore.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/icon.ico',
|
|
apple: '/images/favicon/apple-touch-icon.png',
|
|
},
|
|
};
|
|
};
|