feat: add metadata for SEO optimization in English and Persian message files
This commit is contained in:
@@ -5,6 +5,31 @@ import { notFound } from 'next/navigation';
|
||||
import { NextIntlClientProvider } from 'next-intl';
|
||||
import type { IPageParams } from '@/models/layout.d';
|
||||
import Head from 'next/head';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { host } from '@/config';
|
||||
|
||||
export async function generateMetadata({ params }: { params: IPageParams }) {
|
||||
const { locale } = await params;
|
||||
const t = await getTranslations({ locale });
|
||||
const url = `${host}/${locale}`;
|
||||
|
||||
return {
|
||||
title: {
|
||||
default: t('meta.defaultTitle'),
|
||||
template: t('meta.titleTemplate'),
|
||||
},
|
||||
description: t('meta.defaultDescription'),
|
||||
openGraph: {
|
||||
title: t('meta.defaultTitle'),
|
||||
description: t('meta.defaultDescription'),
|
||||
siteName: t('meta.siteName'),
|
||||
type: 'website',
|
||||
locale,
|
||||
url,
|
||||
},
|
||||
authors: [{ name: t('meta.author') }],
|
||||
};
|
||||
}
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
|
||||
Reference in New Issue
Block a user