>>106336776
Can I ask which one?
For your spaces thing by the way, I have used a filter for "stop words" in the past, then replace whitespace and optionally lowercase it.
I see a lot of sites doing that for article names etc so assume it's the right thing for seo.
export function slugify(s, toLower = true) {
if (!s) return null
const slug = s
.toString()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '') //remove diacritics
.replace(/\s+/g, '-') //spaces to dashes
.replace(/&/g, '-and-') //ampersand to and
.replace(/[^\w\-]+/g, '') //remove non-words
.replace(/\-\-+/g, '-') //collapse multiple dashes
.replace(/^-+/, '') //trim starting dash
.replace(/-+$/, '') //trim ending dash
if (toLower) return slug.toLowerCase()
return slug
}