Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Twig Slugify Filter

Security covered Maintenance fixes only 337 sites

Part of the Twig ecosystem · 43 projects

This module provides a Twig filter that converts text into a URL-friendly "slug" format. You can use it to automatically generate slugs from text fields or strings within your Twig templates, with options to customize the separator and casing.

Implements the cocur/slugify class as a Twig filter for Drupal.

This work carries forward the work in the sandbox here, made compatible for Drupal 9 and 10+.

Usage

After enabling the module you can use the filter in a Twig template on any text field or string value.

Example, on a node with a field_foo value of "This is an Example"

{{ node.field_foo.value|slugify }}

Would render "this-is-an-example".

The filter supports most of the options that the cocur/slugify library supports. For example, disabling the forcing of lowercase and changing the seperator to ***, pass an options object:

{{ node.field_foo.value|slugify({'lowercase': false, "separator": "***"}) }}

Would render "This***is***an***Example".

Drupal 9–11

Ask your assistant about Twig Slugify Filter

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Aug 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
2.0.1 Stable 9–11 May 14, 2024
2.0.0 Stable 9–10 Aug 18, 2023
2.0.x-dev Dev 9–11 Aug 18, 2023