如何在一个布局文件中创建多个{{content}}。像这样......
_layout> default.html中
<html>
<body>
<H2>summary</H2>
<p>
{{content:summary}}
</p>
<H2>detail</H2>
<p>
{{content:detail}}
</p>
</body>
</html>
的index.html
----
layout: default
----
content:summary
<b>show superhero</b>
content:detail
<b>Spiderman Batman Spiderman</b>
输出
<html>
<body>
<H2>summary</H2>
<p>
<b>show superhero</b>
</p>
<H2>detail</H2>
<p>
<b>Spiderman Batman Spiderman</b>
</p>
</body>
</html>
答案 0 :(得分:2)
Jekyll仅支持一个内容区域。你仍然可以使用技巧来得到你的例子中的结果。
只需将摘要放入页面的YAML前端:
----
layout: default
summary: "This is the summary"
----
This is the content
...并将其显示在您的布局文件中:
<html>
<body>
<H2>summary</H2>
<p>
{{ page.summary }}
</p>
<H2>detail</H2>
<p>
{{ content }}
</p>
</body>
</html>
输出将如下所示:
<html>
<body>
<H2>summary</H2>
<p>
This is the summary
</p>
<H2>detail</H2>
<p>
This is the content
</p>
</body>
</html>