0

我有一个 Pug 模板(将成为 root 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>建议我迭代正确的变量(并且该变量是已知的)。

如何从 Array 获取这些元素的内容site.posts

4

1 回答 1

0

我相信这是一个错误,以下工作:

p first line of the page

ul
    each i in site.posts.data
        li= i.title
于 2018-02-22T10:09:03.173 回答