feat(seo): implement B2B dedicated route, structured data schemas, archive optimizations, and SEO database backfill
Deploy Canina / deploy (push) Successful in 1m44s

This commit is contained in:
parsa aghaei committed 2026-08-25 11:19:30 +03:30
1 parent fa69aa4c49
commit 70c2627d93
26 files changed
+18570 -15327

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
import React from "react";
import type { Metadata } from "next";
import B2BLandingClient from "@/components/B2BLandingClient";
import { getPageMetadata } from "@/lib/seo";
import { generateB2BServiceSchema, generateBreadcrumbSchema } from "@/lib/schema";
export async function generateMetadata(): Promise<Metadata> {
return getPageMetadata('b2b', {
canonicalPath: '/b2b',
fallbackTitle: 'خرید عمده مکمل‌های پت کنینا | نمایندگی رسمی و همکاری B2B',
fallbackDesc: 'تأمین عمده و همکاری تجاری مکمل‌های دارویی کنینا آلمان برای کلینیک‌ها، بیمارستان‌های دامپزشکی و پت‌شاپ‌ها با گواهی اصالت و بیشترین حاشیه سود.',
});
}
export default function B2BPage() {
const b2bServiceSchema = generateB2BServiceSchema({
siteUrl: process.env.NEXT_PUBLIC_SITE_URL || 'https://canina.ir',
});
const breadcrumbs = generateBreadcrumbSchema([
{ name: 'صفحه اصلی', url: 'https://canina.ir' },
{ name: 'همکاری تجاری و خرید عمده (B2B)', url: 'https://canina.ir/b2b' },
]);
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(b2bServiceSchema) }}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbs) }}
/>
<B2BLandingClient />
</>
);
}
+48 -18
View File
@@ -10,28 +10,58 @@ export async function generateMetadata(): Promise<Metadata> {
});
}
import { generateLocalBusinessSchema, generateBreadcrumbSchema } from "@/lib/schema";
export default function ContactPage() {
const localBusinessSchema = generateLocalBusinessSchema({
name: 'کنینا ایران',
url: 'https://canina.ir',
telephone: '+989211231517',
address: {
streetAddress: 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
addressLocality: 'تهران',
addressRegion: 'تهران',
postalCode: '1967812345',
addressCountry: 'IR',
},
});
const breadcrumbs = generateBreadcrumbSchema([
{ name: 'صفحه اصلی', url: 'https://canina.ir' },
{ name: 'تماس با ما', url: 'https://canina.ir/contact' },
]);
return (
<div className="bg-medical-gray-50 py-16 px-4 sm:px-6 lg:px-8 font-vazir" dir="rtl">
<div className="max-w-6xl mx-auto space-y-16">
{/* Title */}
<div className="text-center space-y-4">
<span className="inline-flex items-center gap-2 px-4 py-2 bg-canina-blue/5 border border-canina-blue/10 rounded-full text-canina-blue text-xs font-black uppercase tracking-widest">
پاسخگوی شما هستیم
</span>
<h1 className="text-4xl lg:text-5xl font-black text-medical-gray-900 leading-tight">
تماس با <span className="text-canina-blue italic">کنینا ایران</span>
</h1>
<p className="text-lg text-medical-gray-500 max-w-2xl mx-auto leading-relaxed">
جهت مشاوره تخصصی، خرید عمده و پیگیری سفارشات با ما در ارتباط باشید.
</p>
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(localBusinessSchema) }}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbs) }}
/>
<div className="bg-medical-gray-50 py-16 px-4 sm:px-6 lg:px-8 font-vazir" dir="rtl">
<div className="max-w-6xl mx-auto space-y-16">
{/* Title */}
<div className="text-center space-y-4">
<span className="inline-flex items-center gap-2 px-4 py-2 bg-canina-blue/5 border border-canina-blue/10 rounded-full text-canina-blue text-xs font-black uppercase tracking-widest">
پاسخگوی شما هستیم
</span>
<h1 className="text-4xl lg:text-5xl font-black text-medical-gray-900 leading-tight">
تماس با <span className="text-canina-blue italic">کنینا ایران</span>
</h1>
<p className="text-lg text-medical-gray-500 max-w-2xl mx-auto leading-relaxed">
جهت مشاوره تخصصی، خرید عمده و پیگیری سفارشات با ما در ارتباط باشید.
</p>
</div>
<ContactFormClient />
</div>
<ContactFormClient />
</div>
</div>
</>
);
}
+38 -13
View File
@@ -95,28 +95,53 @@ export async function generateMetadata(): Promise<Metadata> {
};
}
import { generateOrganizationSchema } from '../lib/schema';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'Organization',
const orgSchema = generateOrganizationSchema({
name: 'کنینا ایران',
alternateName: 'Canina Iran (Canina pharma GmbH)',
url: 'https://canina.ir',
logo: 'https://canina.de/media/fb/d5/47/1683116813/Logo.png',
contactPoint: {
'@type': 'ContactPoint',
telephone: '+98-21-88884444',
contactType: 'customer service',
email: 'info@canina.ir',
areaServed: 'IR',
availableLanguage: 'Persian'
}
logo: 'https://canina.ir/assets/images/logo.png',
description: 'فروشگاه تخصصی و نماینده انحصاری مکمل‌های دارویی و تقویتی سگ و گربه کنینا آلمان با فرمولاسیون دارویی و تاییدیه بالینی سازمان دامپزشکی کشور.',
telephone: '+989211231517',
email: 'caninairan@gmail.com',
address: {
streetAddress: 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
addressLocality: 'تهران',
addressRegion: 'تهران',
postalCode: '1967812345',
addressCountry: 'IR',
},
sameAs: [
'https://instagram.com/caninairan',
'https://t.me/caninairan',
'https://www.canina.de',
],
});
const webSiteSchema = {
'@context': 'https://schema.org',
'@type': 'WebSite',
'@id': 'https://canina.ir/#website',
url: 'https://canina.ir',
name: 'کنینا ایران | نماینده رسمی مکمل‌های دارویی Canina آلمان',
inLanguage: 'fa-IR',
publisher: {
'@id': 'https://canina.ir/#organization',
},
potentialAction: {
'@type': 'SearchAction',
target: 'https://canina.ir/shop?search={search_term_string}',
'query-input': 'required name=search_term_string',
},
};
const safeJsonLd = JSON.stringify(jsonLd).replace(/</g, '\\u003c');
const safeJsonLd = JSON.stringify([orgSchema, webSiteSchema]).replace(/</g, '\\u003c');
return (
<html lang="fa" dir="rtl" className={`${vazirmatn.variable} ${lalezar.variable}`} suppressHydrationWarning>
+24 -3
View File
@@ -2,10 +2,31 @@ import type { Metadata } from "next";
import ArchivePage from "../../components/ArchivePage";
import { getPageMetadata } from "../../lib/seo";
export async function generateMetadata(): Promise<Metadata> {
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: '/shop',
fallbackTitle: 'فروشگاه تخصصی مکمل‌های دارویی سگ و گربه',
canonicalPath,
fallbackTitle,
fallbackDesc: 'خرید آنلاین انواع مکمل‌های درمانی مفاصل، پوست و مو، گوارش و ایمنی، رشد و ویتامینه سگ و گربه با ضمانت اصالت کنینا آلمان.',
});
}
+61 -3
View File
@@ -1,16 +1,74 @@
import type { Metadata } from 'next';
import VideosPage from "../../components/VideosPage";
import { getPageMetadata } from "../../lib/seo";
import { generateVideoObjectSchema, generateBreadcrumbSchema } from "../../lib/schema";
export async function generateMetadata(): Promise<Metadata> {
return getPageMetadata('videos', {
canonicalPath: '/videos',
fallbackTitle: 'ویدئوهای آموزشی و توصیه‌های بالینی دامپزشکان',
fallbackDesc: 'مشاهده ویدئوهای تخصصی نحوه مصرف مکمل‌های درمانی، نظرات دامپزشکان و راهکارهای بالینی تصویری.',
fallbackDesc: 'مشاهده ویدئوهای تخصصی نحوه مصرف مکمل‌های درمانی، نظرات دامپزشکان و راهکارهای بالینی تصویری کنینا آلمان.',
});
}
export default function Videos() {
return <VideosPage />;
async function getInitialVideos() {
const apiUrl = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4001/api';
const apiBase = apiUrl.endsWith('/api') ? apiUrl : `${apiUrl.replace(/\/$/, '')}/api`;
try {
const res = await fetch(`${apiBase}/videos?limit=20`, {
next: { revalidate: 3600, tags: ['videos'] },
});
if (!res.ok) return [];
const data = await res.json();
return Array.isArray(data) ? data : Array.isArray(data.data) ? data.data : [];
} catch (e) {
console.error('[Videos] Error fetching server videos for schema:', e);
return [];
}
}
export default async function Videos() {
const videos = await getInitialVideos();
const videoSchemas = videos.map((v: any) =>
generateVideoObjectSchema({
name: v.title || 'ویدیو آموزشی کنینا',
description: v.description || `آموزش و توصیه‌های تخصصی دامپزشکی درباره مصرف مکمل‌های درمانی کنینا توسط ${v.doctor || 'متخصصین کنینا'}.`,
thumbnailUrl: v.coverUrl || v.thumbnail || 'https://canina.ir/assets/images/logo.png',
uploadDate: v.createdAt || '2025-01-01T00:00:00Z',
contentUrl: v.videoUrl || undefined,
embedUrl: v.videoUrl || undefined,
})
);
const breadcrumbs = generateBreadcrumbSchema([
{ name: 'صفحه اصلی', url: 'https://canina.ir' },
{ name: 'آکادمی ویدیوها', url: 'https://canina.ir/videos' },
]);
const itemListSchema = {
'@context': 'https://schema.org',
'@type': 'ItemList',
itemListElement: videoSchemas.map((vSchema: any, idx: number) => ({
'@type': 'ListItem',
position: idx + 1,
item: vSchema,
})),
};
return (
<>
{videoSchemas.length > 0 && (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(itemListSchema) }}
/>
)}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbs) }}
/>
<VideosPage />
</>
);
}
+143 -25
View File
@@ -1,21 +1,39 @@
import Link from 'next/link';
import { ChevronRight } from 'lucide-react';
import { ChevronRight, Sparkles, Package, ArrowLeft, ShieldCheck } from 'lucide-react';
import type { Metadata } from 'next';
import { getSeoConfig, formatPageTitle } from "../../../lib/seo";
import { generateMedicalWebPageSchema, generateBreadcrumbSchema } from "../../../lib/schema";
import SafeImage from "../../../components/SafeImage";
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'https://api.canina.ir';
const API_URL = process.env.INTERNAL_API_URL || process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4001/api';
const apiBase = API_URL.endsWith('/api') ? API_URL : `${API_URL.replace(/\/$/, '')}/api`;
async function getWikiTerm(key: string) {
try {
const res = await fetch(`${API_URL}/api/wiki/${encodeURIComponent(key)}`, { next: { revalidate: 60 } });
if (!res.ok) throw new Error('Failed to fetch wiki term');
return res.json();
const res = await fetch(`${apiBase}/wiki/${encodeURIComponent(key)}`, {
next: { revalidate: 3600, tags: ['wiki', `wiki-${key}`] }
});
if (!res.ok) return null;
return await res.json();
} catch (error) {
console.error(error);
console.error('[Wiki] Error fetching term:', error);
return null;
}
}
import { getSeoConfig, formatPageTitle } from "../../../lib/seo";
async function getRelatedProducts(termName: string) {
try {
const res = await fetch(`${apiBase}/products?search=${encodeURIComponent(termName)}&limit=4`, {
next: { revalidate: 3600, tags: ['products'] },
});
if (!res.ok) return [];
const json = await res.json();
return json.data || json || [];
} catch (error) {
console.error('[Wiki] Error fetching related products for ingredient:', error);
return [];
}
}
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const { slug } = await params;
@@ -28,9 +46,12 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
};
}
const rawTitle = term.metaTitle || `ترکیب علمی ${term.term}`;
const rawTitle = term.metaTitle || `ترکیب دارویی و خواص ${term.term}`;
const title = formatPageTitle(rawTitle, config.brandNameFa, config.titleSeparator, config.titlePosition, false);
const description = term.metaDescription || term.definition?.replace(/<[^>]+>/g, '').substring(0, 155).trim() || config.defaultMetaDescription;
const description =
term.metaDescription ||
(term.definition ? term.definition.replace(/<[^>]+>/g, '').substring(0, 155).trim() : '') ||
`بررسی خواص بالینی، فواید و مکمل‌های دارویی حاوی ${term.term} در دامپزشکی کنینا آلمان.`;
const canonicalUrl = `${config.canonicalBaseUrl.replace(/\/$/, '')}/wiki/${slug}`;
return {
@@ -45,7 +66,12 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
url: canonicalUrl,
siteName: config.brandNameFa,
type: "article",
}
},
twitter: {
card: "summary",
title,
description,
},
};
}
@@ -55,7 +81,7 @@ export default async function WikiTermPage({ params }: { params: Promise<{ slug:
if (!term) {
return (
<div className="min-h-[50vh] flex flex-col items-center justify-center font-vazir text-center" dir="rtl">
<div className="min-h-[50vh] flex flex-col items-center justify-center font-vazir text-center px-4" dir="rtl">
<h1 className="text-3xl font-black text-medical-gray-900 mb-4">ترکیب علمی یافت نشد</h1>
<Link href="/wiki" className="text-canina-blue font-bold flex items-center gap-2">
<ChevronRight className="w-4 h-4" />
@@ -65,23 +91,115 @@ export default async function WikiTermPage({ params }: { params: Promise<{ slug:
);
}
const relatedProducts = await getRelatedProducts(term.term);
const medicalSchema = generateMedicalWebPageSchema({
title: `ترکیب درمانی ${term.term} - دانشنامه تخصصی کنینا`,
description: term.metaDescription || (term.definition ? term.definition.replace(/<[^>]+>/g, '').substring(0, 160) : ''),
url: `https://canina.ir/wiki/${slug}`,
aspects: [term.term, 'Veterinary Supplements', 'Pet Nutrition'],
});
const breadcrumbs = generateBreadcrumbSchema([
{ name: 'صفحه اصلی', url: 'https://canina.ir' },
{ name: 'دانشنامه ترکیبات', url: 'https://canina.ir/wiki' },
{ name: term.term, url: `https://canina.ir/wiki/${slug}` },
]);
return (
<div className="bg-white py-20 px-4 font-vazir" dir="rtl">
<div className="max-w-4xl mx-auto">
<Link href="/wiki" className="inline-flex items-center gap-2 text-medical-gray-400 hover:text-canina-blue transition-colors font-bold mb-8">
<ChevronRight className="w-5 h-5" />
بازگشت به دانشنامه
</Link>
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(medicalSchema) }}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbs) }}
/>
<h1 className="text-4xl lg:text-5xl font-black text-medical-gray-900 mb-6 leading-tight">
{term.term}
</h1>
<div className="bg-medical-gray-50 min-h-screen py-12 px-4 sm:px-6 lg:px-8 font-vazir" dir="rtl">
<div className="max-w-4xl mx-auto space-y-8">
{/* Breadcrumb back link */}
<nav className="flex items-center gap-2 text-xs font-bold text-medical-gray-500">
<Link href="/" className="hover:text-canina-blue transition-colors">صفحه اصلی</Link>
<ChevronRight className="w-3.5 h-3.5 text-medical-gray-300" />
<Link href="/wiki" className="hover:text-canina-blue transition-colors">دانشنامه ترکیبات</Link>
<ChevronRight className="w-3.5 h-3.5 text-medical-gray-300" />
<span className="text-canina-blue">{term.term}</span>
</nav>
<div
className="prose prose-lg prose-medical-gray max-w-none prose-headings:font-black prose-p:leading-relaxed prose-a:text-canina-blue"
dangerouslySetInnerHTML={{ __html: term.definition }}
/>
{/* Main Article Container */}
<article className="bg-white border border-medical-gray-200 rounded-[3rem] p-8 md:p-12 shadow-xl space-y-8">
<div className="space-y-3 border-b border-medical-gray-100 pb-6">
<span className="inline-flex items-center gap-1.5 px-3 py-1 bg-canina-blue/5 border border-canina-blue/10 rounded-full text-canina-blue text-xs font-black">
<Sparkles className="w-3.5 h-3.5" />
ماده موثره و ترکیب بالینی
</span>
<h1 className="text-3xl sm:text-4xl lg:text-5xl font-black text-medical-gray-900 leading-tight">
{term.term}
</h1>
</div>
<div
className="prose prose-lg max-w-none text-medical-gray-700 leading-relaxed prose-headings:font-black prose-headings:text-medical-gray-900 prose-p:leading-loose"
dangerouslySetInnerHTML={{ __html: term.definition }}
/>
</article>
{/* Related Products: Bidirectional Internal Linking */}
{relatedProducts && relatedProducts.length > 0 && (
<section className="bg-gradient-to-br from-white to-blue-50/50 border border-medical-gray-200 rounded-[2.5rem] p-8 shadow-lg space-y-6">
<div className="flex items-center justify-between">
<div>
<span className="text-xs font-black text-canina-blue uppercase tracking-wider">
مکمل‌های فرموله شده با این ماده
</span>
<h2 className="text-xl sm:text-2xl font-black text-medical-gray-900 mt-1">
محصولات کنینا حاوی {term.term}
</h2>
</div>
<Link
href={`/shop?search=${encodeURIComponent(term.term)}`}
className="text-xs font-bold text-canina-blue hover:underline flex items-center gap-1"
>
مشاهده همه در فروشگاه
<ArrowLeft className="w-3.5 h-3.5" />
</Link>
</div>
<div className="grid sm:grid-cols-2 gap-4">
{relatedProducts.map((p: any) => (
<Link
key={p.id}
href={`/shop/${p.slug || p.artNo}`}
className="bg-white border border-medical-gray-200 rounded-2xl p-4 flex items-center gap-4 hover:shadow-md hover:border-canina-blue/40 transition-all group"
>
<div className="w-16 h-16 relative bg-medical-gray-50 rounded-xl overflow-hidden shrink-0 border border-medical-gray-100">
<SafeImage
src={p.imageUrl || '/assets/images/placeholder-product.png'}
alt={p.nameFa || p.name}
width={64}
height={64}
className="w-full h-full object-contain p-1 group-hover:scale-105 transition-transform"
/>
</div>
<div className="flex-1 min-w-0">
<h3 className="text-sm font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors truncate">
{p.nameFa || p.name}
</h3>
<p className="text-xs text-medical-gray-500 truncate mt-1">
{p.scientificTagline || p.categorySlug || 'مکمل دارویی استاندارد آلمان'}
</p>
</div>
</Link>
))}
</div>
</section>
)}
</div>
</div>
</div>
</>
);
}