From 505bb9215df6ffce68e33c1f8c87b521cb1c18ff Mon Sep 17 00:00:00 2001 From: Vanja Cosic <1070957+vanjacosic@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:58:28 +0200 Subject: Fix sorting by date on Events page --- events.toml | 20 ++++++++++---------- templates/events.html | 7 ++++++- 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,3 +1,13 @@ +[[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 @@ -21,16 +31,6 @@ https://github.com/dtolnay/proc-macro-workshop

We kindly remind you to cancel your RSVP a day before if you can't make it so that others may attend.

""" -[[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 @@

{{ group | capitalize }}

- {% 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 %} -- cgit v1.2.3