11ty

Eleventy Documentation

This documentation is for an older version. Go to the newest Eleventy docs or check out the full release history.

Documentation Pages

Filters #

Various template engines can be extended with custom filters to modify content. Here’s an example:

<!-- Nunjucks and Liquid use the same syntax -->
<h1>{{ name | makeUppercase }}</h1>

This can be added using the Configuration API. Here are a few examples:

module.exports = function(eleventyConfig) {
// Liquid Filter
eleventyConfig.addLiquidFilter("makeUppercase", function(value) {});
// Nunjucks Filter
eleventyConfig.addNunjucksFilter("makeUppercase", function(value) {});
// Handlebars Filter
eleventyConfig.addHandlebarsHelper("makeUppercase", function(value) {});
// or, use a Universal filter (an alias for all of the above)
eleventyConfig.addFilter("makeUppercase", function(value) {});
};

Read more about filters on the individual Template Language documentation pages:

Universal Filters #

Universal filters can be added in a single place and are available to multiple template engines, simultaneously. This is currently supported in Nunjucks, Liquid, and Handlebars.

module.exports = function(eleventyConfig) {
// Universal filters (Adds to Liquid, Nunjucks, and Handlebars)
eleventyConfig.addFilter("myFilter", function(value) {
return value;
});
};

Eleventy Provided Universal Filters #

We also provide a few universal filters, built-in:


Related Docs