Documentation Pages
Liquid
Template Languages:
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.
Library Options #
Defaults #
Rather than constantly fixing outdated documentation, find getLiquidOptions
in Liquid.js
. These options are different than the default liquidjs
options.
Use your own 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 });};
Set your own Library instance #
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.
⚠️ Not compatible with 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));};
Supported Features #
Feature | Syntax |
---|---|
✅ Include | {% include user %} looks for _includes/user.liquid |
✅ Include | {% include 'user' %} looks for _includes/user.liquid (quotes around includes require dynamicPartials: true —read more at #72) |
✅ Include (pass in Data) | {% include 'user' with 'Ava' %} |
✅ Include (pass in Data) | {% include 'user', user1: 'Ava', user2: 'Bill' %} |
✅ Custom Filters | {{ name | upper }} Read more about Filters |
✅ Eleventy Universal Filters | {% name | filterName %} Read more about Filters |
✅ Custom Tags | {% upper name %} Read more about Filters |