Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 105x 105x 27x | /**
* Slugs that would shadow a STATIC route sibling of /collections/[id].
* Next.js resolves static routes before dynamic ones, so a collection slugged
* "new" would be unreachable. RULE: when you add a static /collections/<x>
* route, add "<x>" here.
*/
export const RESERVED_COLLECTION_SLUGS = new Set<string>(["new"]);
const MAX_SLUG_LENGTH = 40;
/** Lowercase, hyphenate, strip non-[a-z0-9-]. Returns "" if nothing survives. */
export function slugifyName(name: string): string {
return name
.toLowerCase()
.replace(/['’]/g, "")
.replace(/[^a-z0-9]+/g, "-")
.replace(/-+/g, "-")
.replace(/^-|-$/g, "")
.slice(0, MAX_SLUG_LENGTH)
.replace(/-$/, "");
}
|