Skip to content

slugify

Import from @varavel/vdl-plugin-sdk/utils/strings.

function slugify(str): string;

Converts text into a stricter kebab-style slug.

This helper is intended for identifiers that must be more conservative than regular kebabCase, such as URL slugs, file-safe names, anchors, and stable external keys.

Diacritics are flattened to their ASCII counterparts, unsupported characters are removed, and any surrounding hyphens are discarded from the final value. Empty or symbol-only inputs return an empty string.

Parameters

Parameter Type Description
str string Text to normalize into slug form.

Returns

string

A lowercase slug containing only ASCII letters, digits, and hyphens.

Example

slugify("Canción Número 1");
// "cancion-numero-1"