Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Upgrade

Template Filter - slugify


Convert a text into one long word:

<p>{{ text|slugify }}</p>
Run Example »

Definition and Usage

The slugify filter returns a text into one long word containing nothing but lower case ASCII characters and hyphens (-).


- All spaces converted into hyphens.

- Removing all characters that are not aphanumeric, except hyphens and underscores.

- Removes any underscores and/or hyphens at the very beginning or end of the value.

- Converting to lower case characters.


Slugify a text with a lot of not alphanumeric characters:

<p>{{ text|slugify }}</p>
Run Example »


{{ value|slugify }}

Template filters are defined by using a pipe | character followed by the name of the filter.