The Equal Justice Initiative
Eleventy
The possum is Eleventy’s mascot

Eleventy Documentation

This is an older version of Eleventy. Go to the newest Eleventy docs (current path: /docs/filters/slugify/) or the full release history.
Menu

slugify Universal Filter New in v1.0.0 #

In versions prior to 1.0.0, the slug Universal Filter was used. To maintain backwards compatibility moving forward, slug is still included and supported but slugify is now recommended as best practice—it has better default behavior for URLs with special characters.

Uses the @sindresorhus/slugify npm package to convert a string into a URL slug. Typically used with permalinks.

Filename slugify.md
---
title: "My Title"
permalink: "/{{ title | slugify }}/"
---
Outputs to `/my-title/`.

Upgrade from slug to slugify #

If you’re trying to migrate the content in a pre-1.0 project from using the slug filter to the new slugify filter (note: this is optional—you can leave them as-is!), you must take extra care to make sure that any existing URLs don’t change. The @11ty/eleventy-upgrade-help plugin will compare the slug and slugify versions of your URLs to see if there are any that require extra attention (thank you to Peter deHaan for the assist here!).


Other pages in Filters: