How do I create an IF ELSE statement if there are no Jekyll posts in a category?
jekyll
Solution
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 %}
Problem
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?