fix(seo): prevent duplicate brand affixes in page titles and add checkout success metadata
This commit is contained in:
1 parent
c57f775cb4
commit
f81aabb479
15 files changed
+9682
-9548
No files matched your search
@@ -1,4 +1,14 @@
|
||||
import type { Metadata } from 'next';
|
||||
import OrderSuccess from "../../../../components/OrderSuccess";
|
||||
import { getPageMetadata } from "../../../../lib/seo";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return getPageMetadata('checkout_success', {
|
||||
fallbackTitle: 'سفارش با موفقیت ثبت شد',
|
||||
fallbackDesc: 'رسید پرداخت و جزئیات ثبت سفارش در کنینا ایران.',
|
||||
noIndex: true,
|
||||
});
|
||||
}
|
||||
|
||||
export default async function SuccessPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
|
||||
@@ -21,8 +21,9 @@ export async function generateMetadata(
|
||||
|
||||
const nameFa = product.nameFa || product.name;
|
||||
const nameEn = product.nameEn ? ` (${product.nameEn})` : '';
|
||||
const rawTitle = `${nameFa}${nameEn}`;
|
||||
const title = product.metaTitle || formatPageTitle(rawTitle, config.brandNameFa, config.titleSeparator, config.titlePosition, false);
|
||||
const rawTitle = product.metaTitle || `${nameFa}${nameEn}`;
|
||||
const title = formatPageTitle(rawTitle, config.brandNameFa, config.titleSeparator, config.titlePosition, false);
|
||||
const ogTitle = `${title} ${config.titleSeparator} ${config.brandNameFa}`;
|
||||
const description = product.metaDescription || (product.shortDescription || product.description || '').substring(0, 155).trim() || config.defaultMetaDescription;
|
||||
|
||||
const rawKeywords = product.keywords;
|
||||
@@ -71,7 +72,7 @@ export async function generateMetadata(
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
title: ogTitle,
|
||||
description,
|
||||
images: galleryImages,
|
||||
url: canonicalUrl,
|
||||
|
||||
@@ -14,10 +14,10 @@ export async function generateMetadata({
|
||||
const canonicalPath = category ? `/shop?category=${encodeURIComponent(category)}` : '/shop';
|
||||
|
||||
const categoryTitles: Record<string, string> = {
|
||||
'joints': 'مکملهای مفاصل و استخوان سگ و گربه | کنینا ایران',
|
||||
'immune': 'مکملهای تقویت سیستم ایمنی و گوارش پت | کنینا ایران',
|
||||
'energy': 'ویتامینها و انرژیبخشهای درمانی سگ و گربه | کنینا ایران',
|
||||
'special-care': 'محصولات مراقبت ویژه پوست، مو و دندان پت | کنینا ایران',
|
||||
'joints': 'مکملهای مفاصل و استخوان سگ و گربه',
|
||||
'immune': 'مکملهای تقویت سیستم ایمنی و گوارش پت',
|
||||
'energy': 'ویتامینها و انرژیبخشهای درمانی سگ و گربه',
|
||||
'special-care': 'محصولات مراقبت ویژه پوست، مو و دندان پت',
|
||||
};
|
||||
|
||||
const fallbackTitle = category && categoryTitles[category]
|
||||
|
||||
Reference in new issue
Block a user