slug
Makes text safe for a file name or link: lower case, accents folded, dashes between words.
Details #
slug(text, separator?) lower-cases the text, folds accents (é becomes e), and turns every run of anything that is not a letter or digit into one separator, with none at either end. The separator is - unless you give another.
It is also the slug op of Transform text (the separator param).
Parameters #
Takes 1 to 2 arguments.
{{ slug(text, b?) }}
Examples #
slug("Café Déjà Vu!")→
cafe-deja-vuslug("Q3 report (final).pdf", "_")→
q3_report_final_pdfGotchas #
Case boundaries are not word breaks:
slug("parseURL")isparseurl. Use kebabCase for that.Letters in other scripts are kept (
slug("日本語 test")is日本語-test).