我有一个jekyll网站,文件结构如下:
? _includes/
post-entry.html
? _posts/
2012-11-25-first-post.markdown
index.markdown
Run Code Online (Sandbox Code Playgroud)
在我的index.markdown中,我想包括post-entry.html这样的:
{% for post in site.posts %}
* {% include post-entry.html %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
但这在博客中显示为HTML代码段.如何防止HTML受到保护?
cbo*_*tig 12
您可以在任何降价文件中使用液体标签,只要它具有YAML标题即可.例如,查看jekyll 站点的jekyllbootstrap模板中给出的index.md.
如果你链接到你的实际index.markdown或你的存储库本身(例如,如果它在github上),我们可能会更好地了解出了什么问题.您的示例应该可行,但您可能需要使用HTML列表元素<li>而不是markdown *.
问题是解析器将 HTML 视为代码块。最好的方法是像我在这个问题中问的那样关闭代码块
要解决此问题,请使用替换标记:
{% capture includeGuts %}
{% include post-entry.html %}
{% endcapture %}
{{ includeGuts | replace: ' ', ''}}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12206 次 |
| 最近记录: |