diff --git a/layouts/index.html b/layouts/index.html index 2d35157d..40aa84cb 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -224,8 +224,8 @@ {{ with .Site.GetPage "/termine/_index.md" }} {{ $events := slice }} - {{ range .Params.events }} - {{ if or (ge (.date | time.AsTime).Unix now.Unix) (and .enddate (ge (.enddate | time.AsTime).Unix now.Unix)) }} + {{ range sort .Params.events ".date" }} + {{ if partial "data/termin-upcoming" . }} {{ $events = $events | append . }} {{ end }} {{ end }} diff --git a/layouts/partials/data/termin-upcoming.html b/layouts/partials/data/termin-upcoming.html new file mode 100644 index 00000000..3d093194 --- /dev/null +++ b/layouts/partials/data/termin-upcoming.html @@ -0,0 +1 @@ +{{ return or (ge (.date | time.AsTime) now) (and .enddate (ge (.enddate | time.AsTime) now)) }} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 5993a5d6..c72db478 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -86,7 +86,7 @@ {{ $top_banner := .Site.Data.homepage.top_banner }} {{ if and $top_banner.enable }} - {{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime).Unix now.Unix ) (ge ($top_banner.temporarily.end_date | time.AsTime).Unix now.Unix))) }} + {{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime) now) (ge ($top_banner.temporarily.end_date | time.AsTime) now))) }} {{ with $top_banner }}