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

EJS

Template Languages:

Eleventy Short Name File Extension NPM Package
ejs .ejs ejs

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

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 EJS library using the Configuration API.

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

Compile/Render Options

New in Eleventy v0.3.0: See “Options” on the EJS home page.

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

Supported Features

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