【发布时间】:2015-08-23 16:37:15
【问题描述】:
我按照这篇文章http://support.ghost.org/create-custom-page-template/ 中描述的步骤创建了一个自定义页面。
我想在此页面中显示我所有博客文章的索引。没有描述,只有标题。
所以,我在http://myadress/test 上创建了一个静态页面 并在我的根文件夹中创建一个 page-test.hbs。在这个文件中我写了这段代码来做一个测试:
{{!< default}}
<ol class="posts">
{{#foreach posts}}
<table>
<thead>
<tr>
<th>test</th>
</tr>
</thead>
<tbody>
<tr>
<td>test</td>
</tr>
</tbody>
</table>
{{/foreach}}
</ol>
<table>
<thead>
<tr>
<th>test</th>
</tr>
</thead>
<tbody>
<tr>
<td>test</td>
</tr>
</tbody>
</table>
foreach 中的代码没有被执行。但外面是。
现在,我是 Ghost 的新手,所以帖子变量可能什么都没有,对吧?如何将帖子列表放入其中?
提前致谢(:
【问题讨论】:
标签: handlebars.js blogs ghost-blog