Eleventy Documentation

This is an older version of Eleventy. Full release history. Go to the newest Eleventy docs. You could try /docs/languages/ejs/ although it may not exist.

Documentation Pages


Template Languages:

Eleventy Short NameFile ExtensionNPM Package

You can override a .ejs file’s template engine. Read more at Changing a Template’s Rendering Engine.

EJS Options #

Optional: Compile/Render Options New in v0.3.0 #

See “Options” on the EJS home page.

module.exports = function(eleventyConfig) {
    // use <? ?> instead of <% %>
    delimiter: "?"

Optional: Set your own Library instance New in v0.3.0 #

As an escape mechanism for advanced usage, pass in your own instance of the EJS library using the Configuration API.

module.exports = function(eleventyConfig) {
let ejs = require("ejs");
eleventyConfig.setLibrary("ejs", ejs);

Supported Features #

✅ Include (Preprocessor Directive)<% include /user/show %> looks for _includes/user/show.ejs (does not process front matter)
✅ Include (pass in Data)<%- include('/user/show', {user: 'Ava'}) %> looks for _includes/user/show.ejs (does not process front matter)