如何在哈巴狗模板中获取Hexo构建的站点变量?

时间:2018-02-21 10:27:18

标签: pug templating hexo pugjs

我有一个Pug模板(对于什么将成为根index.html),它应该只列出我帖子的标题:

p first line of the page

ul
    each post in site.posts
        li= post.title

p last line of the page

在构建网站时,我会进入index.html

<p>first line of the page</p>
<ul>
    <li></li>
    <li></li>
</ul>
<p>last line of the page</p>

我在这个网站上有两个帖子,两个<li></li>建议我迭代正确的变量(并且变量是已知的)。

如何从数组site.posts获取这些元素的内容?

1 个答案:

答案 0 :(得分:0)

我相信这是a bug,以下作品:

p first line of the page

ul
    each i in site.posts.data
        li= i.title
相关问题