0
votes

First day with Jekyll, I basically have the minima theme from Jekyll that I'm modifying trying to create a new site.

I have a home.html within _layouts. My goal is to place paragraphs within 3 individual columns, side-by-side. My understanding is that _layouts and _includes are mainly for formatting, at least that's how I look at them. I aware one can put a bunch of static text to display within these files, but it seems cleaner (and easier to edit) if the text to display were in something like a _pages folder. But of course doing so creates a new link in the header. So I am trying to find a way insert a markdown file which is just paragraphs of text that I can cleanly insert into my main home page, and only there.

How and where does one place markdown (paragraph sizes) for the sole purpose of inserting into layouts or includes, but not writing them directly into the layout or include, nor making it a post or a page, or using variables within _data. I was hoping to make a markdown file for smaller purposes than posts, pages, etc...

My _layouts/home.html looks as follows, but the markdown isn't showing up. IIRC, this is because includes can only access _includes, and I was hoping not to have to write this data within _includes or html's.

---
layout: default
---

<div class="home">
    <div class="home-col-wrapper">
        <div class="home-col home-col-1">
            {% include front-col-1.md %}
        </div>
    </div>

    <div class="home-col home-col-2">
            {% include front-col-2.md %}
        column 2
    </div>

    <div class="home-col home-col-3">
            {% include front-col-3.md %}
        column 3
    </div>
</div>

I also tried putting an *.md file in _pages and changing the layout to home, but to no avail. The text didn't show up in the home layout.

---
layout: home
---

A bunch of stuff should probably go here. So be sure to make sure it looks ok. ok? ok! 
1

1 Answers

1
votes

I just did something similar. If I understand your question correctly, all you need to do is to replace {% include front-col-1.md %} by

{% capture temp %}{% include front-col-1.md %}{% endcapture %}
{{ temp  | markdownify }}

What happens is that Liquid captures the markdown file in the variable temp, and then markdownify converts it into HTML and adds it.

I don't think you can put the markdown files elsewhere, but they need to be in _includes.

Related: https://github.com/jekyll/jekyll-help/issues/51