HTML
| 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.
使用相同的输入和输出目录
当 --input 和 --output 被设置为同一个目录时(这不是默认设置),请留意 HTML 类型的模版。
如果你多次运行 Eleventy,它也会尝试处理输出的文件,这可能会报重复模板错误。
$ npx @11ty/eleventy --input=. --output=. --formats=md,html
Writing ./README/index.html from ./README.md
$ npx @11ty/eleventy --input=. --output=. --formats=md,html
The second run will attempt to write ./README/index.html from both ./README.md and ./README/index.html, resulting in a Duplicate Permalink Error (two templates writing to the same location). You can workaround this issue using the Ignores feature.第二次运行时,Eleventy 将尝试把 ./README.md 和 ./README/index.html 转换为 ./README/index.html,从而导致重复目标文件(Duplicate Permalink)的错误(即,两个模板写入同一位置)。您可以使用 Ignores 功能 解决这个问题。
如果要使用 --formats=html,最好不要使用相同的输入和输出目录。
Other pages in Template Languages
- HTML
- Markdown
- JavaScript
- Custom
- WebC
- Nunjucks
- Liquid
- Handlebars
- Mustache
- EJS
- HAML
- Pug
- Sass
- Virtual Templates
- Overriding Languages
