I have a FOR statement that outputs all posts of type jobs
.
{% for post in site.categories.jobs %} <article> <h3><a href="{{ post.permalink }}">{{ post.title }}</a></h3> <p>{{ post.summary }}</p> </article> {% endfor %}
But if there are no published posts in jobs
I would like to display a "We're not hiring right now" message.
Can you create an IF/ELSE statement to check for posts in a specific category?
Try check it with {% if site.categories.jobs == null %}
.
{% if site.categories.jobs == null %} <p>We're not hiring right now</p> {% else %} {% for post in site.categories.jobs %} <article> <h3><a href="{{ post.permalink }}">{{ post.title }}</a></h3> <p>{{ post.summary }}</p> </article> {% endfor %} {% 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