Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

Template Filter - slugify


Example

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 (-).

Meaning:

- 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.

Example

Slugify a text with a lot of not alphanumeric characters:

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

Syntax

{{ value|slugify }}

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