Search code examples
markdownjekyllkramdown

Can I use markdown in Jekyll 1.5.1 layouts?


In Jekyll 1.5.1 my layouts are being parsed, but markdown is being ignored.

Is there a way to work around this?

Here is my post.md layout

---
layout: default
---
<h2>{{ page.title }}</h2>
<p class="meta"></p>

<div class="post">
{{ content }}
</div>

* first
* second
* third

# hi

The page.title, content, and the layout are picked up, so I know Jekyll is parsing the file.

I expect the first second and third to be in a list and I expect the hi to be an h1, but they don't get picked up by markdown, while other files like test.md do (in fact test.md even uses this layout).


Solution

  • I wanted to include a submenu for a particular sub directory in my default layout. I got it to work like this:

    {% if page.url contains '/for-citizens/'' %}
      {% capture submenu %}{% include for-citizens-menu.md%}{% endcapture %}
      <div class="navbar-collapse collapse">
        <ul id="navList" class="nav navbar-nav">
          {{ submenu | markdownify }}
        </ul>
      </div>
    {% endif %}