Stand with Ukraine 🇺🇦
Eleventy
The possum is Eleventy’s mascot
Eleventy Documentation
Menu
Eleventy 5.81s
Gatsby 43.36s

Template Languages

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:

  1. The file extension (importantly, this is also used to find files to process).
  2. Configuration options:
    • markdownTemplateEngine: The default global template engine to pre-process markdown files. Use false to avoid pre-processing and only transform markdown.
    • htmlTemplateEngine: The default global template engine to pre-process HTML files. Use false to avoid pre-processing and passthrough copy the content (HTML is not transformed, so technically this could be any plaintext).
  3. 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:

Filename example.liquid
---
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
---

Template Languages: