feat: add metadata for SEO optimization in English and Persian message files

This commit is contained in:
2025-06-16 14:27:41 +03:30
parent 96e0fc9e0d
commit 5818c895cd
5 changed files with 70 additions and 24 deletions
+25
View File
@@ -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,
+1 -1
View File
@@ -1,4 +1,4 @@
export const port = process.env.PORT || 3000;
export const host = process.env.VERCEL_PROJECT_PRODUCTION_URL
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
? `${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
: `http://localhost:${port}`;