I'm making a job listing page using Jekyll and I decided to create a separate data file with the job positions available.
I'd like to add a condition where if there's no positions available (the data file is empty), a specific message would appear.
So I have a job.html where the listing should be displayed and the code I tried for showing the listing or message is:
<!-- Jobs -->
<section class="jobs">
{% if site.data.jobs == '' %}
<h1>No job openings right now!</h1>
{% else %}
{% for job in site.data.jobs %}
<h1>{{ job.title }}</h1>
<h2>{{ job.link }}</h2>
{% endfor %}
{% endif %}
</section>
It didn't work, so I tried to hack it by only verifying if there's empty title tags, like so:
<!-- Jobs -->
<section class="jobs">
{% if site.data.jobs.title == '' %}
<h1>No job openings right now!</h1>
{% else %}
{% for job in site.data.jobs %}
<h1>{{ job.title }}</h1>
<h2>{{ job.link }}</h2>
{% endfor %}
{% endif %}
</section>
Also did not work. Any ideas how to solve this?