canina/frontend/application/app/shop/page.tsx
parsa aghaei 70c2627d93
All checks were successful
Deploy Canina / deploy (push) Successful in 1m44s
feat(seo): implement B2B dedicated route, structured data schemas, archive optimizations, and SEO database backfill
2026-08-25 11:19:30 +03:30

54 lines
2.7 KiB
TypeScript

import type { Metadata } from "next";
import ArchivePage from "../../components/ArchivePage";
import { getPageMetadata } from "../../lib/seo";
export async function generateMetadata({
searchParams,
}: {
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
}): Promise<Metadata> {
const resolvedParams = await searchParams;
const category = typeof resolvedParams.category === 'string' && resolvedParams.category !== 'all' ? resolvedParams.category : '';
// Clean canonical: ignore faceted filter noise like symptoms, sort, search, and petType in canonical tag
const canonicalPath = category ? `/shop?category=${encodeURIComponent(category)}` : '/shop';
const categoryTitles: Record<string, string> = {
'joints': 'مکمل‌های مفاصل و استخوان سگ و گربه | کنینا ایران',
'immune': 'مکمل‌های تقویت سیستم ایمنی و گوارش پت | کنینا ایران',
'energy': 'ویتامین‌ها و انرژی‌بخش‌های درمانی سگ و گربه | کنینا ایران',
'special-care': 'محصولات مراقبت ویژه پوست، مو و دندان پت | کنینا ایران',
};
const fallbackTitle = category && categoryTitles[category]
? categoryTitles[category]
: 'فروشگاه تخصصی مکمل‌های دارویی سگ و گربه';
return getPageMetadata('shop', {
canonicalPath,
fallbackTitle,
fallbackDesc: 'خرید آنلاین انواع مکمل‌های درمانی مفاصل، پوست و مو، گوارش و ایمنی، رشد و ویتامینه سگ و گربه با ضمانت اصالت کنینا آلمان.',
});
}
export default async function Shop({ searchParams }: { searchParams: Promise<{ [key: string]: string | string[] | undefined }> }) {
const resolvedParams = await searchParams;
const category = typeof resolvedParams.category === 'string' ? resolvedParams.category : "all";
const search = typeof resolvedParams.search === 'string' ? resolvedParams.search : "";
const petType = typeof resolvedParams.petType === 'string' ? resolvedParams.petType : "all";
// Support both ?symptoms= (multi, from sidebar URL state) and ?symptom= (single, from megamenu/PDP links)
const symptomsParam = typeof resolvedParams.symptoms === 'string' ? resolvedParams.symptoms : "";
const symptomSingle = typeof resolvedParams.symptom === 'string' ? resolvedParams.symptom : "";
const symptoms = symptomsParam || (symptomSingle ? symptomSingle : "");
return (
<ArchivePage
initialCategory={category}
initialSearch={search}
initialPetType={petType}
initialSymptoms={symptoms}
/>
);
}