Defines what a slug is: the readable name of a category, a dump or a playlist in a page URL. The server makes and checks slugs with it, and the edit forms prefill their slug field with slugify.

Functions

f
isValidSlug(
slug: string,
max?: number
): boolean

Checks whether slug matches SLUG_RE and is at most max characters long.

f
slugify(
title: string,
max?: number
): string

Turns title into lowercase ASCII words joined by hyphens, at most max characters long, cut at a hyphen when it must be cut. Accents are dropped, and a title with no ASCII letter or digit gives untitled. The result always passes isValidSlug.

Variables

v
SLUG_MAX: 60

The longest a dump's or a playlist's slug may be.

v
SLUG_RE: RegExp

Matches a well-formed slug: lowercase letters and digits, in words joined by single hyphens. Categories, dumps and playlists share it.