Eleventy(11ty) logo Eleventy
The possum is Eleventy’s mascot
Eleventy 中文文档
Menu
Eleventy 1.93s
Next.js 70.65s

HTML

Template Languages:

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.

使用相同的输入和输出目录 Jump to heading

WARNING:
这是一个 常见错误

--input--output 被设置为同一个目录时(这不是默认设置),请留意 HTML 模版类型的文件。

如果你多次运行 eleventy,输出的 HTML 文件会被误处理的!

$ 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

如果你要是设置 --formats=html 参数时,最好不要将输入和输出目录设置为同一目录。

此外,你可能会注意到上面第二个示例的输出中,第二个模板(即 ./README/index.html)的输出文件名为 index-o.html。当输入和输出目录相同 并且 模板名为 index.html 时,我们会为输出文件的文件名添加一个 -o 后缀,以避免覆盖自身。这是一种特殊情况,仅适用于 index.html 文件名。你可以设置 htmlOutputSuffix 参数 来改变默认的 -o 后缀。


Other pages in Template Languages:


相关文档