ScienceNoob
ScienceNoob

Reputation: 231

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

I want to display the content of an markdown file on my homepage, build with the static site generator jekyll. But jekyll dont render the markdown. Anybody an idea what i make wrong? Result:

enter image description here

Code index.html

---
layout: default
---

<div class="home">

  {% include index.md %}

</div>

Code _includes/default.html

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

Code _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/)

Upvotes: 1

Views: 388

Answers (1)

David Jacquel
David Jacquel

Reputation: 52829

First of all, includes are not supposed to have front matter. Remove it from _includes/index.html. This must now read as :

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

Including markdown file from an html post/page is not working straight.

In order to include a .md file from an .html one, you need to capture, then markdownify.

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

Upvotes: 4

Related Questions