Skip to content

Commit cfd0763

Browse files
committed
use where_exp filter to avoid Boolean template variable
1 parent 40aad98 commit cfd0763

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

index.html

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,21 @@ <h2>
2020
Upcoming Events
2121
</h2>
2222

23-
{% assign upcoming_events = false %}
23+
{% assign upcoming_events = site.posts | where_exp: 'post', 'post.date >= site.time' %}
24+
{% if upcoming_events.size == 0 %}
25+
<p>There are no upcoming workshops.</p>
26+
{% else %}
2427
<ul id="events-list">
25-
{% for post in site.posts reversed %}
26-
{% if post.date >= site.time %}
27-
{% assign upcoming_events = true %}
28-
<li>
29-
<div class="background-image city" style="background-image: url({{ post.city_image_url }})"></div>
30-
<div class="background-image organizer" style="background-image: url({{ post.organizer_image_url }})"></div>
31-
<h3><a class="post-link" href="{{ post.url }}">{{ post.title }}</a></h3>
32-
<p>{{ post.workshop_dates }}</li>
33-
</li>
34-
{% endif %}
35-
{% endfor %}
28+
{% for post in upcoming_events reversed %}
29+
<li>
30+
<div class="background-image city" style="background-image: url({{ post.city_image_url }})"></div>
31+
<div class="background-image organizer" style="background-image: url({{ post.organizer_image_url }})"></div>
32+
<h3><a class="post-link" href="{{ post.url }}">{{ post.title }}</a></h3>
33+
<p>{{ post.workshop_dates }}</li>
34+
</li>
35+
{% endfor %}
3636
</ul>
37-
{% unless upcoming_events %}
38-
<p>There are no upcoming workshops.</p>
39-
{% endunless %}
37+
{% endif %}
4038

4139
</div>
4240
</div>

0 commit comments

Comments
 (0)