Jekyll: Using liquid tags in .md files

1.9k views Asked by At

I am working on a project using Jekyll. Looking online, it seems that it is possible to use liquid tags in a markdown file. For some reason, the liquid tags are not working in my markdown files. I want to use the liquid "capture" tag to store text in a variable and then output that variable in the layout.html file. I have listed the related code below.

page.md:

---
page: approach
layout: layout
---

{% capture Focus_content %}

Focus devices are awesome.

{% endcapture %}

Layout.html:

<!-- layout.html file -->
<div class="panel">
<div class="content-container panel-wrapper">

{{Focus_content}}

</div><!--end content container-->
</div><!--end panel-->

I know that Jekyll supports liquid templates. Does anyone know why when I define the variable in my markdown file, it does not output anything on the webpage when I include it in the html file?

1

There are 1 answers

0
David Jacquel On BEST ANSWER

No way to do this. Inside a layout, the only things you get from your pages, posts and collections are the content, site and page variables.

A capture made in a page, post or collection is not bubbling up to the layout.