Eleventy Short Name | File Extension | NPM Package |
---|---|---|
liquid |
.liquid |
liquidjs |
You can override a .liquid
file’s template engine. Read more at Changing a Template’s Rendering Engine.
Rather than constantly fixing outdated documentation, find getLiquidOptions
in Liquid.js
. These options are different than the default liquidjs
options.
New in Eleventy v0.2.15
: It’s recommended to use the Configuration API to set override the default options above.
module.exports = function(eleventyConfig) {
eleventyConfig.setLiquidOptions({
dynamicPartials: true
});
};
New in Eleventy v0.3.0
: As an escape mechanism for advanced usage, pass in your own instance of the Liquid library using the Configuration API. See all liquidjs
options.
setLiquidOptions
above—this method will ignore any configuration set there.
module.exports = function(eleventyConfig) {
let liquidJs = require("liquidjs");
let options = {
extname: ".liquid",
dynamicPartials: true,
root: ["_includes"]
};
eleventyConfig.setLibrary("liquid", liquidJs(options));
};
Feature | Syntax |
---|---|
✅ Include | {% include 'user' %} looks for _includes/user.liquid |
✅ Include (pass in Data) | {% include 'user' with 'Ava' %} |
✅ Include (pass in Data) | {% include 'user', user1: 'Ava', user2: 'Bill' %} |
✅ Custom Filters | {{ name | upper }} (see eleventyConfig.addLiquidFilter documentation) |
✅ Eleventy Universal Filters | {% name | filterName %} (see eleventyConfig.addFilter documentation) |
✅ Custom Tags | {% upper name %} (see eleventyConfig.addLiquidTag documentation) |