【发布时间】:2018-11-19 13:50:05
【问题描述】:
我有一个页面显示我的帖子,如下所示
{% for post in site.posts limit:3 %}
<a href="{{site.baseurl}}{{post.url}}" style="text-decoration: none; margin: 1rem;">
<div class="newsBox">
<div style="margin: auto;">
<h1 style="text-align: center; color: white;">{{post.title}}</h1>
<p style="text-align: center; color: white;">
{{post.description}}
</p>
<p style="text-align: center; color: #101a31; font-style: italic; font-size: 1.2rem;">
{{post.date | date:"%d-%m-%Y"}}
</p>
</div>
</div>
</a>
{% endfor %}
这很好用,但如果有更多未显示的帖子,我也想显示一个“更多”按钮。有谁知道如何做到这一点?
【问题讨论】:
-
好的,所以我通过这样做
{% assign psize = site.posts | size %} {% if psize > 3 %} <p>more posts</p> {% endif %}搞定了,但现在我需要知道如何显示接下来的 3 个帖子..