teqo-backup/src/utilities/slug.ts
Francisco Ignácio Fontoura Solla 28647e4760 Add Post and Tag collections for news and publications
- Add Post + Tag collections (notícias/publicações) with tag-based
  "Esconder" visibility control for electoral-law compliance
- Add static SEO routes /[type]/[category]/[slug] plus /[type] and
  /[type]/[category] listings, with shared header/breadcrumb and PostCard
- Recreate the homepage and refresh the site color palette (styles.css)
- Add posts/slug/seo utilities and revalidation wiring (documents.ts)
- Add live-fetch seed script (scripts/seed-posts.mjs + seed-loader.mjs,
  db:seed:posts)
- Upgrade Payload 3.79.0 -> 3.82.0 (fixes admin relationship-filter crash)
- Remove obsolete Header component; add shadcn card/badge/breadcrumb;
  update AGENTS.md and components rule docs
2026-07-15 19:12:11 -03:00

8 lines
321 B
TypeScript

export const slugify = (value: string): string =>
value
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '') // strip accents
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-') // non-alphanumeric -> hyphen
.replace(/-+/g, '-') // collapse hyphens
.replace(/^-|-$/g, '') // trim leading/trailing hyphens