如何在jekyll的markdown文件中包含HTML文件? [英] How to include a HTML file inside a markdown file in jekyll?

查看:88
本文介绍了如何在jekyll的markdown文件中包含HTML文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jekyll网站,其文件结构如下:

I have a jekyll site with filestructure like so:

▾ _includes/
    post-entry.html
▾ _posts/
    2012-11-25-first-post.markdown
index.markdown

在我的index.markdown中,我想包含这样的post-entry.html:

In my index.markdown, I want to include a post-entry.html like this:

{% for post in site.posts %}
* {% include post-entry.html %}
{% endfor %}

但这在博客中显示为HTML代码段.我如何防止HTML被 受保护的?

But this appears as a HTML code snippet in the blog. How can i prevent the HTML from being protected?

推荐答案

您可以在任何markdown文件中使用液体标签,只要它具有YAML标头即可.例如,查看 index.md 一个用于Jekyll网站的href ="https://github.com/plusjade/jekyll-bootstrap" rel ="noreferrer"> jekyllbootstrap模板.

You can use liquid tags in any markdown file so long as it has YAML header matter. For instance, check out the index.md given in the jekyllbootstrap template for Jekyll sites.

如果您链接到实际的index.markdown或存储库本身(例如,如果它在github上),我们可能会更好地了解出了什么问题.您的示例应该可以运行,尽管您可能需要使用HTML列表元素<li>而不是markdown *.

If you link to your actual index.markdown or your repository itself (e.g. if it's on github), we could probably get a better idea of what has gone wrong. Your example should work, though you might need to use HTML list element <li> rather than the markdown *.

这篇关于如何在jekyll的markdown文件中包含HTML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆