我有一个 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
?