Skip to navigation Skip to main content
Eleventy
Eleventy Documentation
Stable
3.0.0
Toggle Menu
Eleventy 1.93s
Gatsby 29.05s

slugify Universal Filter

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

Filename slugify.md
---
title: "My Title"
permalink: "/{{ title | slugify }}/"
---
Outputs to `/my-title/`.
INFO:
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.
WARNING:
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)

Changing 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 in v1.0) 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 Upgrade Helper 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: