// Canonical Meshkee detail URLs are /{id}/{slug} — the slug segment is // SEO-only, so it is built from the Farsi name rather than the DB slug. export function faSlug(input: string | null | undefined): string { if (!input) return "-"; return ( input .trim() .replace(/[\/\?%*:|"'<>.,()]/g, "") .replace(/\s+/g, "-") .slice(0, 80) || "-" ); } export function productHref(id: string, nameFa?: string | null, title?: string | null): string { return `/products/${id}/${faSlug(nameFa || title)}`; } export function categoryHref(id: string, nameFa?: string | null, name?: string | null): string { return `/products/category/${id}/${faSlug(nameFa || name)}`; } export function blogHref(id: string, title?: string | null): string { return `/blog/${id}/${faSlug(title)}`; }