Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
23 lines
872 B
TypeScript
23 lines
872 B
TypeScript
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
|
||
}
|