HTML 来自 _includes 未显示使用 Jekyll 包含的位置
HTML from _includes not showing where included using Jekyll
我正在使用 GitHub 页面托管个人网站。
我想通过利用 GitHub 的内置 Jekyll 模板功能减少 HTML 代码重复。例如,将 footer.html
放入 /_includes
目录以便在以后的每个页面上重复使用。
我也 碰巧 喜欢组织我的文件,所以我把我的 'real' index.html
放在 /html
子目录中,与我所有其他 html 文件。 GitHub 页面不喜欢这样,所以我在根目录中使用了 dummy index.html
,这样站点将由 GitHub.
加载
每当我使用:
---
---
在 .html
文件的顶部 在 我的 /html
目录中,它们很奇怪地在顶部呈现为文本。事实上,我的 {% includes foo.html %} 调用也是如此。
为什么会这样?
如果您使用 'dummy' index.html
解决方法,您还需要在根目录中启用 Liquid,方法是:
---
---
在你的假人的顶部 index.html
:
index.html (dummy) <- double '---' here
html/
├─ index.html
├─ foo.html <- double '---' here to use {% includes bah.html %}
_includes/
├─ bah.html
帮助一分钱下降。
我正在使用 GitHub 页面托管个人网站。
我想通过利用 GitHub 的内置 Jekyll 模板功能减少 HTML 代码重复。例如,将 footer.html
放入 /_includes
目录以便在以后的每个页面上重复使用。
我也 碰巧 喜欢组织我的文件,所以我把我的 'real' index.html
放在 /html
子目录中,与我所有其他 html 文件。 GitHub 页面不喜欢这样,所以我在根目录中使用了 dummy index.html
,这样站点将由 GitHub.
每当我使用:
---
---
在 .html
文件的顶部 在 我的 /html
目录中,它们很奇怪地在顶部呈现为文本。事实上,我的 {% includes foo.html %} 调用也是如此。
为什么会这样?
如果您使用 'dummy' index.html
解决方法,您还需要在根目录中启用 Liquid,方法是:
---
---
在你的假人的顶部 index.html
:
index.html (dummy) <- double '---' here
html/
├─ index.html
├─ foo.html <- double '---' here to use {% includes bah.html %}
_includes/
├─ bah.html