// تنظیم عنوان صفحه و توضیح متا — محتوای سئو از دیتابیس می‌آید export function setMetaDescription(content: string): void { let el = document.querySelector('meta[name="description"]') if (!content.trim()) { el?.remove() return } if (!el) { el = document.createElement('meta') el.setAttribute('name', 'description') document.head.appendChild(el) } el.setAttribute('content', content.trim()) } /** کلید سئوی مسیر جاری — فقط صفحه‌های فهرست دقیق؛ صفحه‌های جزئیات خودشان عنوان می‌گذارند */ export function seoKeyForPath(pathname: string): string | null { if (pathname === '/') return 'home' const seg = pathname.split('/')[1] ?? '' const known = ['about', 'services', 'projects', 'investment', 'blog', 'faq', 'contact'] // مسیرهای جزئی مثل /blog/{slug} شامل نمی‌شوند تا اثر خود صفحه جزئیات برسانند return known.includes(seg) && pathname === `/${seg}` ? seg : null }