Hi. So I’m trying to show a message when there’s not posts (children) under a page. Here’s my code:
{% if not page.find('/insights').children %}
<p>There are not posts</p>
{% else %}
<div id="post-list" class="flex-container grid">
{% for post in page.find('/insights').children.order('date', 'desc').slice(0, 3) %}
<div class="col-4">
<a class="post-list--item" href='{{post.url}}'>
<header>
{% for tag in post.taxonomy.tag %}
<span class="tag {{ label_style ?: 'label-secondary' }} p-category" href="{{ blog.url|rtrim('/') }}/tag{{ config.system.param_sep }}{{ tag }}#body-wrapper">{{ tag }}</span>
{% endfor %}
<h2 class="post-item--title">{{ post.title }}</h2>
</header>
<footer>
<span class="post-item--date">{{ post.date|date("M j, Y")}}</span>
<span class="post-item--arrow">
</span>
</footer>
</a>
</div>
{% endfor %}
</div>
{% endif %}
Now for some reason it works in a way that the posts do only show when there’s child pages but the notification doesn’t show up when there’s none. What am I doing wrong?