summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanja Cosic <1070957+vanjacosic@users.noreply.github.com>2024-04-15 17:58:28 +0200
committerVanja Cosic <1070957+vanjacosic@users.noreply.github.com>2024-04-15 17:58:28 +0200
commit505bb9215df6ffce68e33c1f8c87b521cb1c18ff (patch)
tree509f9164f81f88aefea3e47c0f92619656c64a7e
parent47f6d3507f772f5c09a89cfb89a6bf63ca9b58a7 (diff)
downloadcph-rust-website-505bb9215df6ffce68e33c1f8c87b521cb1c18ff.zip
Fix sorting by date on Events pageHEADmain
-rw-r--r--events.toml20
-rw-r--r--templates/events.html7
2 files changed, 16 insertions, 11 deletions
diff --git a/events.toml b/events.toml
index f5032d4..925e5a7 100644
--- a/events.toml
+++ b/events.toml
@@ -1,4 +1,14 @@
[[upcoming]]
+title = "Meetup #46"
+date = 2024-04-25 18:00:00+02:00
+venue = "Nine A/S"
+address = "Kongens Nytorv 18, 1050 København"
+url = ""
+content = """
+TBA
+"""
+
+[[upcoming]]
title = "Hacknight #4"
date = 2024-04-16 17:00:00+02:00
venue = "KEA"
@@ -21,16 +31,6 @@ https://github.com/dtolnay/proc-macro-workshop</p>
We kindly remind you to cancel your RSVP a day before if you can't make it so that others may attend.</p>
"""
-[[upcoming]]
-title = "Meetup #46"
-date = 2024-04-25 18:00:00+02:00
-venue = "Nine A/S"
-address = "Kongens Nytorv 18, 1050 København"
-url = ""
-content = """
-TBA
-"""
-
[[recent]]
title = "Meetup #45"
date = 2024-03-27 18:00:00+01:00
diff --git a/templates/events.html b/templates/events.html
index 3fefc7a..7a75111 100644
--- a/templates/events.html
+++ b/templates/events.html
@@ -17,7 +17,12 @@
<section>
<h2 id="{{group}}">{{ group | capitalize }}</h2>
- {% for event in meetups[group] %}
+ {% set events_sorted = meetups[group] | sort(attribute="date") | reverse %}
+
+ {# Reverse sorting again for upcoming events #}
+ {% if group == 'upcoming' %}{% set events_sorted = events_sorted | reverse %}{% endif %}
+
+ {% for event in events_sorted %}
{% set event_page = section.pages | filter(attribute="title", value=event.title) | first%}
{% if event_page %}