Menu
- Why Eleventy?
- Getting Started
- Community
- Working with Templates
- Using Data
- Configuration
- Template Languages
- Plugins
- API Services
- Release History
- Advanced
5.81s
43.36s
Template Languages
- HTML
*.html
- Markdown
*.md
- WebC
*.webc
- JavaScript
*.11ty.js
- Liquid
*.liquid
- Nunjucks
*.njk
- Handlebars
*.hbs
- Mustache
*.mustache
- EJS
*.ejs
- Haml
*.haml
- Pug
*.pug
- Custom
*.*
Overriding the Template Language Jump to heading
There are a couple of different ways you can tell Eleventy how you want to process a file:
- The file extension (importantly, this is also used to find files to process).
- Configuration options:
markdownTemplateEngine
: The default global template engine to pre-process markdown files. Usefalse
to avoid pre-processing and only transform markdown.htmlTemplateEngine
: The default global template engine to pre-process HTML files. Usefalse
to avoid pre-processing and passthrough copy the content (HTML is not transformed, so technically this could be any plaintext).
templateEngineOverride
in the template’s front matter. Should be one templating engine (liquid
) or markdown paired with another templating engine (liquid,md
). See examples below.
templateEngineOverride
Examples
Jump to heading
Replace with a single templating engine Jump to heading
If your file is called example.liquid
—instead of liquid
, this will be parsed as a njk
Nunjucks template:
---
templateEngineOverride: njk
---
Special case: pairing a templating engine with md
Markdown
Jump to heading
Remember that—by default—Markdown files are processed with an additional preprocessor template engine set globally with the markdownTemplateEngine
configuration option. So, when using templateEngineOverride
on markdown files be sure to list each templating engine you’d like to use.
For example, you may want to process njk
Nunjucks first and then md
markdown afterwards. Markdown is supported either by itself or with another engine. No other templating engines can be combined in this way—Markdown is the exception here. Any other combination attempt will throw an error.
Markdown and nothing else
---
templateEngineOverride: md
---
Nunjucks and then Markdown
---
templateEngineOverride: njk,md
---
Use nothing (no transformations)
Any falsy value here will just copy the template content without transformation.
---
templateEngineOverride: false
---