我正在使用Jekyll建立一个简单的博客,我正在试图找出这个问题.
该网站的索引页面旨在展示一篇最新的文章,其结构类似于下面的内容(原谅这个混乱):
{% for post in site.posts reversed limit:1 %}
<div class="post">
<div class="post-inner">
<h3 class="posttitle"><a href="{{ post.url }}">{{ post.title }}</a></h3>
<p class="postdate">{{ post.date | date: "%d %B %Y" }}</p>
{{ post.content }}
<a href="{{ post.url }}#disqus_thread" class="commentLink"></a>
</div>
</div>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)
当限制不是限制性的时(即不存在或设置为数组的长度),上述模板完全正常.似乎只有当限制实际上限制了循环忽略的结果时.
我已经尝试清除浏览器缓存,这是它无限制地工作的原因:1,但进度到此结束.
感谢您的帮助,如果这还不够,我很乐意提供更多细节.