我正在使用Jekyll(3.0+),我有index.html
:
---
layout: mylayout
---
<div>
{{ site.posts[0].content }}
</div>
正如您所看到的,我只想显示第一篇帖子,_layouts/mylayout.html
是:
<article itemtype="http://schema.org/BlogPosting">
<header>
<h1>{{ page.title }}</h1>
</header>
<div>
{{ content }}
</div>
</article>
问题是我看不到mylayout.html
的包装结构,我只能看到内容降价翻译!所以,我原以为:
<article itemtype="http://schema.org/BlogPosting">
<header>
<h1>Page title</h1>
</header>
<div>
<section>My post paragraph</section>
<p>Hello, this is my post.</p>
</div>
</article>
但我得到了这个:
<div>
<section>My post paragraph</section>
<p>Hello, this is my post.</p>
</div>
我如何参考整个页面?
答案 0 :(得分:0)
看起来我需要使用output
属性:
---
layout: mylayout
---
<div>
{{ site.posts[0].output }}
</div>
这基本上会返回整个HTML,包括模板!