为什么 Jekyll 不在主页上渲染 Markdown 文件?

Why Jekyll don´t render the Markdown File on Homepage?

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

代码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/)

首先,include 不应该有 front matter。 _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 post/page 的 markdown 文件无法正常工作。

为了包含 .html 文件中的 .md 文件,您需要 capture,然后 markdownify

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