How can I check if there are no posts in the _posts
folder?
So far, I've tried
{% if site.posts == null %}
<p>No posts...yet.</p>
{% endif %}
and
{% if site.posts == nil %}
<p>No posts...yet.</p>
{% endif %}
Is this possible in Liquid?
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 %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With