/** @param {string} name */ export function categorySlug(name) { const slug = name .normalize('NFKC') .toLowerCase() .match(/[\p{L}\p{N}]+/gu) ?.join('-'); if (!slug) throw new Error(`Category needs a name with letters or numbers: ${name}`); return slug; } /** @param {string} slug */ export const categoryId = (slug) => `categories/${slug}`; /** @param {string} slug */ export const categoryHref = (slug) => `/${categoryId(slug)}/`;