← All packages

@lacspace/slugify

v1.1.1SEO Kit0 deps

Turn any text into a clean, SEO-friendly URL slug — transliterates diacritics, collapses separators, and guarantees uniqueness against an existing set. Zero-dependency, isomorphic.

npm i @lacspace/slugify

Usage

slugify.ts
import { slugify, uniqueSlug } from "@lacspace/slugify";

slugify("Héllo, World! — 2026");            // "hello-world-2026"
slugify("StockYatra: Paper Trading");        // "stockyatra-paper-trading"
slugify("Über Café", { separator: "_" });    // "uber_cafe"
slugify("A very long article title here", { maxLength: 15 }); // "a-very-long" (word boundary)

uniqueSlug("Hello", new Set(["hello", "hello-2"])); // "hello-3"

Exports 4

slugifyslugifyFilenameslugifyPathuniqueSlug

Keywords

slugifyslugurl-slugseotransliteratepermalink

More in SEO Kit