Jekyll:在 .md 文件中使用液体标签

Hea*_*ess 5 html markdown liquid jekyll

我正在使用 Jekyll 开发一个项目。网上查了一下,似乎可以在markdown文件中使用liquid标签。由于某种原因,液体标签在我的 Markdown 文件中不起作用。我想使用液体“捕获”标签将文本存储在变量中,然后在layout.html 文件中输出该变量。我在下面列出了相关代码。

页面.md:

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

{% capture Focus_content %}

Focus devices are awesome.

{% endcapture %}
Run Code Online (Sandbox Code Playgroud)

布局.html:

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

{{Focus_content}}

</div><!--end content container-->
</div><!--end panel-->
Run Code Online (Sandbox Code Playgroud)

我知道 Jekyll 支持液体模板。有谁知道为什么当我在 markdown 文件中定义变量时,当我将其包含在 html 文件中时,它不会在网页上输出任何内容?

Dav*_*uel 3

没有办法做到这一点。在布局中,您从页面、帖子和集合中获得的唯一内容是contentsite变量page

在页面、帖子或集合中进行的捕获不会冒泡到布局中。