# Slugify Zero-dependency URL-safe slug generator with unicode->ascii transliteration. ``` python scripts/run.py "Héllo, World!" python scripts/run.py "My Blog Post Title" -s _ python scripts/run.py "Keep Café" --unicode python scripts/run.py "Very Long Heading Text" --max-len 12 printf 'One Title\nTwo Title\n' | python scripts/run.py - --each-line ``` Built on stdlib `unicodedata` + `re`. --- name: slugify display_name: Slugify description: "Turn any text or title into a clean URL-safe slug, transliterating unicode/accents to ascii. Triggers: slugify, url slug, make slug, permalink, ascii slug." --- # Slugify Convert titles and arbitrary text into clean, URL-safe slugs. ## When to use The user has a title/heading/phrase and needs a slug for a URL, filename, or anchor — including text with accents or non-ascii characters. ## How to use Run `scripts/run.py` with text: - `python scripts/run.py "Héllo, World!"` -> `hello-world` - `python scripts/run.py "My Title" -s _` -> `my_title` (underscore separator). - `python scripts/run.py "Keep Café" --unicode` -> `keep-café`. - `python scripts/run.py "Long Title Here" --max-len 10` — truncate cleanly. Omit the text (or pass `-`) to read stdin; `--each-line` slugifies lines independently. ## Pitfalls - Default mode is ascii-only: accents are transliterated (é->e, ß->ss) and unknown symbols dropped. Use `--unicode` to keep unicode letters. - Leading/trailing/duplicate separators are collapsed automatically. - `--max-len` truncates then trims a trailing separator so slugs never end with one.
Slugify by langbot-team
Turn any text or title into a clean URL-safe slug, transliterating unicode/accents to ascii.
Loading...