我在用杰基尔做一个项目。从网上看,似乎可以在降价文件中使用液体标签。由于某些原因,液体标签在我的标记文件中不起作用。我想使用liquid“capture”标记将文本存储在变量中,然后将该变量输出到layout.html文件中。下面列出了相关代码。
第.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-->
我知道jekyll支持液体模板。有人知道为什么当我在标记文件中定义变量时,当我将它包含在html文件中时,它不会在网页上输出任何内容吗?
最佳答案
没办法。在布局中,从页面、帖子和集合中获得的唯一信息是content
、site
和page
变量。
在页面、文章或集合中进行的捕获不会冒泡到布局中。
关于html - Jekyll:在.md文件中使用液体标签,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30650571/