From 0b378250941ca7663e9c3e5b34705995a564a236 Mon Sep 17 00:00:00 2001 From: parsa aghaei Date: Wed, 2 Sep 2026 13:32:33 +0330 Subject: [PATCH] feat(seo): add sitemaps, RSS feeds, robots.txt, and Torob crawler endpoints directory to SeoSettingsPage --- .../admin-panel/src/pages/SeoSettingsPage.tsx | 237 +++++++++++++++++- 1 file changed, 236 insertions(+), 1 deletion(-) diff --git a/frontend/admin-panel/src/pages/SeoSettingsPage.tsx b/frontend/admin-panel/src/pages/SeoSettingsPage.tsx index 6bdf510..00c2b85 100644 --- a/frontend/admin-panel/src/pages/SeoSettingsPage.tsx +++ b/frontend/admin-panel/src/pages/SeoSettingsPage.tsx @@ -1,5 +1,9 @@ import { useState, useEffect } from 'react'; -import { Globe, Save, Sliders, Monitor, Sparkles, Search, BarChart3, Code2, CheckCircle2, HelpCircle, Activity, ExternalLink, ShieldCheck } from 'lucide-react'; +import { + Globe, Save, Sliders, Sparkles, Search, BarChart3, Code2, + CheckCircle2, Activity, ExternalLink, Copy, Check, Rss, + FileCode, Bot, ShoppingBag, Layers, Info +} from 'lucide-react'; import { toast } from 'react-hot-toast'; import api from '../services/api'; import Spinner from '../components/ui/Spinner'; @@ -29,6 +33,16 @@ export default function SeoSettingsPage() { const [isLoading, setIsLoading] = useState(true); const [isSaving, setIsSaving] = useState(false); const [isMediaSelectorOpen, setIsMediaSelectorOpen] = useState(false); + const [copiedKey, setCopiedKey] = useState(null); + + const handleCopy = (text: string, key: string, label: string) => { + navigator.clipboard.writeText(text); + setCopiedKey(key); + toast.success(`آدرس ${label} کپی شد`); + setTimeout(() => { + setCopiedKey((curr) => (curr === key ? null : curr)); + }, 2500); + }; useEffect(() => { let isSubscribed = true; @@ -635,6 +649,227 @@ export default function SeoSettingsPage() { + {/* Section 4: Sitemaps, Feeds & Price Crawlers (GSC, Torob, RSS) */} +
+
+
+ +

+ آدرس‌های فنی سئو، نقشه‌های سایت و فیدهای خزش (Sitemaps, RSS & Crawlers) +

+
+ + تولید خودکار و بلادرنگ (Dynamic SSR) ⚡ + +
+ + {/* Quick GSC Help Banner */} +
+
+
+ +
+
+

+ راهنمای ثبت در گوگل سرچ کنسول (Google Search Console): +

+

+ در پنل سرچ کنسول به منوی Sitemaps بروید و در کادر افزودن نقشه سایت، فقط عبارت sitemap.xml را وارد کرده و دکمه Submit را بزنید. +

+
+
+ + ورود به بخش Sitemaps سرچ کنسول + + +
+ + {/* Endpoints Groups */} +
+ {[ + { + groupTitle: 'نقشه‌های سایت گوگل و موتورهای جستجو (XML Sitemaps)', + groupBadge: 'Google & Bing', + groupBadgeColor: 'bg-blue-50 text-blue-700 border-blue-200', + items: [ + { + key: 'sitemap-main', + title: 'نقشه سایت اصلی و جامع (Main Index Sitemap)', + path: '/sitemap.xml', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/sitemap.xml`, + desc: 'نقشه سایت اصلی که باید در گوگل سرچ کنسول ثبت شود (تمام محصولات، دسته‌ها و صفحات را پوشش می‌دهد).', + tag: 'اصلی (GSC)', + tagColor: 'bg-emerald-50 text-emerald-700 border-emerald-200', + }, + { + key: 'sitemap-products', + title: 'نقشه اختصاصی تمام محصولات (Products XML)', + path: '/sitemap-products.xml', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/sitemap-products.xml`, + desc: 'فهرست مستقیم تمام مکمل‌ها و محصولات دارویی با تاریخ آخرین ویرایش.', + tag: 'محصولات', + tagColor: 'bg-blue-50 text-blue-700 border-blue-200', + }, + { + key: 'sitemap-categories', + title: 'نقشه اختصاصی دسته‌بندی‌ها (Categories XML)', + path: '/sitemap-categories.xml', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/sitemap-categories.xml`, + desc: 'فهرست لینک‌های دسته‌بندی موضوعی و تخصصی کالاها.', + tag: 'دسته‌ها', + tagColor: 'bg-purple-50 text-purple-700 border-purple-200', + }, + { + key: 'robots-txt', + title: 'فایل راهنمای خزنده‌ها و ربات‌ها (Robots.txt)', + path: '/robots.txt', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/robots.txt`, + desc: 'دستورالعمل دسترسی ربات‌های Googlebot و اعلام مسیر رسمی نقشه سایت.', + tag: 'ربات‌ها', + tagColor: 'bg-gray-100 text-gray-700 border-gray-200', + }, + ], + }, + { + groupTitle: 'فیدهای وب‌سرویس ترب و مقایسه‌گرها (Torob & Price Aggregators)', + groupBadge: 'Torob API', + groupBadgeColor: 'bg-red-50 text-red-700 border-red-200', + items: [ + { + key: 'torob-products', + title: 'فید تجمیعی تمام محصولات ترب (Torob Products Feed API)', + path: '/api/torob/products', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/api/torob/products`, + desc: 'آدرس رسمی جهت تحویل به پشتیبانی ترب برای خزش خودکار موجودی، قیمت‌های تومانی و تخفیف‌ها.', + tag: 'پنل فروشندگان ترب', + tagColor: 'bg-red-50 text-red-700 border-red-200 font-bold', + }, + { + key: 'torob-single', + title: 'استعلام لحظه‌ای تکی کالا در ترب (Torob Single Product API)', + path: '/api/torob/products/[id]', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/api/torob/products/{productId}`, + desc: 'اندپوینت استعلام فوری وضعیت موجودی و قیمت محصول هنگام کلیک کاربر در ترب.', + tag: 'تکی ترب', + tagColor: 'bg-orange-50 text-orange-700 border-orange-200', + }, + ], + }, + { + groupTitle: 'فیدهای RSS و اشتراک محتوا (RSS & XML Feeds)', + groupBadge: 'RSS Feeds', + groupBadgeColor: 'bg-amber-50 text-amber-700 border-amber-200', + items: [ + { + key: 'rss-blog', + title: 'فید آر‌اس‌اس وبلاگ و مقالات (Blog RSS Feed)', + path: '/blog/rss.xml', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/blog/rss.xml`, + desc: 'فید استاندارد XML آخرین مقالات تخصصی، اخبار و راهنماهای سلامتی حیوانات.', + tag: 'RSS وبلاگ', + tagColor: 'bg-amber-50 text-amber-700 border-amber-200', + }, + { + key: 'feed-shop', + title: 'فید کالاهای فروشگاه (Products Feed XML)', + path: '/shop/feed.xml', + url: `${(seo.canonicalBaseUrl || 'https://canina.ir').replace(/\/+$/, '')}/shop/feed.xml`, + desc: 'فید XML کالاهای فروشگاه جهت اشتراک در کانال‌ها و موتورهای توزیع محتوا.', + tag: 'فید فروشگاه', + tagColor: 'bg-teal-50 text-teal-700 border-teal-200', + }, + ], + }, + ].map((group, gIdx) => ( +
+
+

+ + {group.groupTitle} +

+ + {group.groupBadge} + +
+ +
+ {group.items.map((item) => { + const isCopied = copiedKey === item.key; + return ( +
+
+
+ + {item.title} + + + {item.tag} + +
+

+ {item.desc} +

+
+ +
+
+ {item.url} +
+ +
+ + مشاهده + + + +
+
+
+ ); + })} +
+
+ ))} +
+
+