Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.93 KB

html.md

File metadata and controls

38 lines (27 loc) · 1.93 KB
eleventyNavigation layout relatedLinks
parent key order
Template Languages
HTML
1
layouts/langs.njk
/docs/config/#default-template-engine-for-html-files
Default Template Engine for HTML Files
Eleventy Short Name File Extension npm Package
html .html N/A

HTML files are pre-processed by default as Liquid templates. This is an optional feature and can be changed to a different template engine of your choice or disabled entirely. Furthermore, it can be configured on a per-template basis or globally. Read more at Changing a Template’s Rendering Engine.

Using the Same Input and Output Directories

{% callout "warn" %}This is a Common Pitfall.{% endcallout %}

Careful with the HTML template type when using the same --input and --output directory (this is not the default).

If you run eleventy more than once, it’ll try to process your output files too.

$ eleventy --input=. --output=. --formats=md,html
Writing ./README/index.html from ./README.md

$ eleventy --input=. --output=. --formats=md,html
Writing ./README/index.html from ./README.md
Writing ./README/index-o.html from ./README/index.html

If you’re going to use --formats=html, it’s probably best not using the same input and output directories.

Moreover, you may notice in the above output that the second template wrote to index-o.html. When the input and output directories are the same and the source template is named index.html, we add an -o suffix to avoid overwriting itself. This is a special case that only applies to index.html filenames. You can customize the -o suffix with the htmlOutputSuffix configuration option.