Files
myeasycms-v2/apps/web/lib/root-metdata.ts
Giancarlo Buomprisco 5b9285a575 Next.js 15 Update (#26)
* Update Next.js and React versions in all packages
* Replace onRedirect function with next/link in BillingSessionStatus, since it's no longer cached by default
* Remove unused revalidatePath import in billing return page, since it's no longer cached by default
* Add Turbopack module aliases to improve development server speed
* Converted new Dynamic APIs to be Promise-based
* Adjust mobile layout
* Use ENABLE_REACT_COMPILER to enable the React Compiler in Next.js 15
* Report Errors using the new onRequestError hook
2024-10-22 14:39:21 +08:00

40 lines
1009 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/favicon.ico',
apple: '/images/favicon/apple-touch-icon.png',
},
};
};