如何检查_posts文件夹中是否没有帖子?
到目前为止,我已经尝试过
{% if site.posts == null %}
<p>No posts...yet.</p>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
和
{% if site.posts == nil %}
<p>No posts...yet.</p>
{% endif %}
Run Code Online (Sandbox Code Playgroud)
这在液体中可能吗?
Grab the size of the posts array and then compare that to 0:
{% assign psize = site.posts | size %}
{% if psize == 0 %}
<p>No posts...yet.</p>
{% endif %}
Run Code Online (Sandbox Code Playgroud)