Optimize content fetching and update configurations
Content fetching in the marketing section has been refactored to utilize the Next.js cache, which significantly improves performance. The date format of publishedAt has been updated to be more consistent across files. Code related to CSRF token, fonts, and metadata has been refactored into separate files for easier maintenance and readability.
This commit is contained in:
30
apps/web/lib/fonts.ts
Normal file
30
apps/web/lib/fonts.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Urbanist as HeadingFont, Inter as SansFont } from 'next/font/google';
|
||||
|
||||
/**
|
||||
* @sans
|
||||
* @description Define here the sans font.
|
||||
* By default, it uses the Inter font from Google Fonts.
|
||||
*/
|
||||
const sans = SansFont({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-sans',
|
||||
fallback: ['system-ui', 'Helvetica Neue', 'Helvetica', 'Arial'],
|
||||
preload: true,
|
||||
weight: ['300', '400', '500', '600', '700'],
|
||||
});
|
||||
|
||||
/**
|
||||
* @heading
|
||||
* @description Define here the heading font.
|
||||
* By default, it uses the Urbanist font from Google Fonts.
|
||||
*/
|
||||
const heading = HeadingFont({
|
||||
subsets: ['latin'],
|
||||
variable: '--font-heading',
|
||||
fallback: ['system-ui', 'Helvetica Neue', 'Helvetica', 'Arial'],
|
||||
preload: true,
|
||||
weight: ['500', '700'],
|
||||
});
|
||||
|
||||
// we export these fonts into the root layout
|
||||
export { sans, heading };
|
||||
32
apps/web/lib/root-metdata.ts
Normal file
32
apps/web/lib/root-metdata.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Metadata } from 'next';
|
||||
|
||||
import appConfig from '~/config/app.config';
|
||||
|
||||
/**
|
||||
* @name rootMetadata
|
||||
* @description Define the root metadata for the application.
|
||||
*/
|
||||
export const rootMetadata: Metadata = {
|
||||
title: appConfig.name,
|
||||
description: appConfig.description,
|
||||
metadataBase: new URL(appConfig.url),
|
||||
openGraph: {
|
||||
url: appConfig.url,
|
||||
siteName: appConfig.name,
|
||||
description: appConfig.description,
|
||||
},
|
||||
twitter: {
|
||||
card: 'summary_large_image',
|
||||
title: appConfig.title,
|
||||
description: appConfig.description,
|
||||
},
|
||||
icons: {
|
||||
icon: '/images/favicon/favicon.ico',
|
||||
shortcut: '/shortcut-icon.png',
|
||||
apple: '/images/favicon/apple-touch-icon.png',
|
||||
other: {
|
||||
rel: 'apple-touch-icon-precomposed',
|
||||
url: '/apple-touch-icon-precomposed.png',
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user