11tyThe possum is Eleventy’s mascot

Eleventy Documentation

Menu

Pug

Template Languages:

Eleventy Short NameFile ExtensionNPM Package
pug.pugpug

Pug templates used to be called Jade templates and the project was renamed.

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

Pug Options #

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

Set compile/render options using the Configuration API. See all Pug options.

module.exports = function(eleventyConfig) {
eleventyConfig.setPugOptions({ debug: true });
};

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

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

Supported Features #

FeatureSyntax
✅ Includes (Absolute Path)include /includedvar.pug looks in _includes/includedvar.pug. Does not process front matter in the include file.
✅ Includes (Relative Path) New in v0.2.15Relative paths use ./ (template’s directory) or ../ (template’s parent directory).

Example: {% include ./included.pug %} looks for included.pug in the template’s current directory. Does not process front matter in the include file.
✅ Extends (Absolute Path)extends /layout.pug looks in _includes/layout.pug. Does not process front matter in the include file.
✅ Extends (Relative Path) New in v0.2.15Relative paths use ./ (template’s directory) or ../ (template’s parent directory).

Example: {% extends ./layout.pug %} looks for layout.pug in the template’s current directory. Does not process front matter in the extends file.