为什么Jekyll不在主页上呈现Markdown文件?

时间:2015-08-01 12:40:56

标签: markdown jekyll

我想在我的主页上显示markdown文件的内容,使用静态站点生成器jekyll构建。但杰基尔不会降价。有人知道我做错了吗?结果:

enter image description here

代码index.html

---
layout: default
---

<div class="home">

  {% include index.md %}

</div>

代码_includes / default.html

<div class="page-content">
      <div class="wrapper">
        {{ content }}
      </div>
    </div>

代码_includes / index.md

---
layout: default
title: Home
permalink: /
---

This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](http://jekyllrb.com/)

1 个答案:

答案 0 :(得分:2)

首先,包括不应该有前面的事情。从_includes/index.html 删除。现在必须写为:

This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](http://jekyllrb.com/)

包含来自html帖子/页面的markdown文件无法正常工作。

要包含.md.html文件,您需要capture,然后markdownify

---
layout: default
---
<div class="home">
  {% capture index %}{% include index.md %}{% endcapture %}
  {{ index | markdownify }}    
</div>