Stand with Ukraine 🇺🇦
Eleventy
The possum is Eleventy’s mascot

Eleventy Documentation

Menu

slugify Universal Filter New in v1.0.0 Jump to heading

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/`.
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.
slugify currently ignores characters for Japanese, Chinese, and others. If you need to slugify these characters, add your own universal filter with an alternative library like limax or transliteration. (More context at Issue #2537)

Upgrade from slug to slugify Jump to heading

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: