admin/lib/seo/contentQuality.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

23 lines
872 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

interface SeoEventQualityCandidate {
slug?: string | null
title?: string | null
shortDescription?: string | null
description?: string | null
}
const PLACEHOLDER_SLUG_PATTERNS = [/^generated-[a-z0-9]+$/i, /(?:^|-)copy(?:-|$)/i, /^bag+$/i, /^event-[0-9a-f]{8}$/i]
const PLACEHOLDER_TEXT_PATTERNS = [/^رویداد جدید\s*\d+$/u, /seed factory/i]
/** Excludes obvious seed/clone placeholders from public SEO discovery surfaces. */
export function isSeoEligibleEvent(event: SeoEventQualityCandidate): boolean {
const slug = event.slug?.trim() ?? ''
const text = [event.title, event.shortDescription, event.description].filter(Boolean).join(' ')
if (!slug) return false
if (PLACEHOLDER_SLUG_PATTERNS.some((pattern) => pattern.test(slug))) return false
if (PLACEHOLDER_TEXT_PATTERNS.some((pattern) => pattern.test(text))) return false
return true
}