Theme: Keep current event for 6 hours after start date

Events are shown in the "Neuigkeiten" section until their start date has been reached.
As we deploy quite often, this means, that the currently running event will disappear when it's still going.
As we don't know the end date, just show them for 6 more hours.
This commit is contained in:
jtbx 2024-03-02 22:22:42 +01:00 committed by jtbx
parent 765d271531
commit 7e29bd5369

View file

@ -5,7 +5,8 @@
</div>
{{- $events := where (.Site.GetPage "blog").Pages ".Params.categories" "event" }}
{{- $upcoming := where $events ".Params.date" "ge" now }}
{{- $lookback := time.ParseDuration "-6h" }}
{{- $upcoming := where $events ".Params.date" "ge" (time.Now.Add $lookback) }}
{{ if $upcoming }}
<div class="announcements">
<h2 id="neuigkeiten" class="on-hover-trg">Neuigkeiten <a href="#neuigkeiten" class="on-hover"><i class="fa-solid fa-link small"></i></a></h2>