Skip to content

Commit ba4e03e

Browse files
committed
Automatically filter events by date
1 parent 74b34e9 commit ba4e03e

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

_data/events.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
upcoming:
2-
past:
3-
- name: Paris 2021
4-
url: https://paris2021.hack-commit-pu.sh/
5-
img: hcp-paris-2021.png
6-
- name: Paris 2020
7-
url: https://paris2020.hack-commit-pu.sh/
8-
img: hcp-paris-2020.png
9-
- name: Paris 2019
10-
url: https://paris2019.hack-commit-pu.sh/
11-
img: hcp-paris-2019.png
1+
- name: Paris 2021
2+
url: https://paris2021.hack-commit-pu.sh/
3+
img: hcp-paris-2021.png
4+
# 2021-05-29 19:00:00+0200
5+
end_timestamp_millis: 1622307600
6+
- name: Paris 2020
7+
url: https://paris2020.hack-commit-pu.sh/
8+
img: hcp-paris-2020.png
9+
# 2020-06-27 19:00:00+0200
10+
end_timestamp_millis: 1593277200
11+
- name: Paris 2019
12+
url: https://paris2019.hack-commit-pu.sh/
13+
img: hcp-paris-2019.png
14+
# 2019-06-15 19:00:00+0200
15+
end_timestamp_millis: 1560618000

_includes/past.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
<h2 class="section-heading">Past events</h2>
77
<hr class="light">
88
</div>
9-
{% include _events.html events=site.data.events.past %}
9+
{% assign now = 'now' | date: '%s' | to_integer %}
10+
{% assign past_events = site.data.events | where_exp:"event", "event.end_timestamp_millis < now" %}
11+
{% include _events.html events=past_events %}
1012
</div>
1113
</div>
1214
</div>

_includes/upcoming.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ <h2 class="section-heading">Upcoming events</h2>
1111
<p>Follow our <a rel="noopener" target="_blank" class="page-scroll" href="https://twitter.com/{{site.twitter_username}}">Twitter account</a> to stay in touch!</p>
1212
</div>
1313
{% else %}
14-
{% include _events.html events=site.data.events.upcoming %}
14+
{% assign now = 'now' | date: '%s' | to_integer %}
15+
{% assign upcoming_events = site.data.events | where_exp:"event", "event.end_timestamp_millis >= now" %}
16+
{% include _events.html events=upcoming_events %}
1517
{% endif %}
1618
</div>
1719
</div>

0 commit comments

Comments
 (0)