aboutsummaryrefslogtreecommitdiff
path: root/www/index.nix
diff options
context:
space:
mode:
Diffstat (limited to 'www/index.nix')
-rw-r--r--www/index.nix68
1 files changed, 44 insertions, 24 deletions
diff --git a/www/index.nix b/www/index.nix
index e60325f..d4b1fcc 100644
--- a/www/index.nix
+++ b/www/index.nix
@@ -11,37 +11,57 @@
files =
with lib.fileset;
toList (difference (fileFilter (file: file.hasExt "html") root) ./html/Kalender);
- replacements = {
- "@title@" = config.title;
- "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">'';
- "@head@" = ''
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width">
- <meta name="description" content="Informationen zum Stadtteil Heimfeld und seinem Stadtteilbeirat">
- <meta name="keywords" content="Heimfeld, Stadtteil, Hamburg, Stadtteilbeirat, Beirat, Stadtteilfest, Treffpunkthaus">
- <link rel="shortcut icon" type="image/x-icon" href="/img/Kraniche-dreh-klein.gif">
- <script async src="redirects.js"></script>
- '';
- "@past-events@" =
- with lib;
- let
- as-list = mapAttrsToList (name: value: {
- start = value.date.start + value.time.start;
- value = toString value;
- }) config.events;
- sorted = sortOn (event: event.start) as-list;
- in
- ''
+ replacements =
+ let
+ events =
+ with lib;
+ let
+ as-list = mapAttrsToList (name: value: {
+ start = value.date.start + value.time.start;
+ value = toString value;
+ }) config.events;
+ in
+ sortOn (event: event.start) as-list;
+ in
+ {
+ "@title@" = config.title;
+ "@published@" = config.published;
+ "@stylesheet@" = ''<link rel="stylesheet" type="text/css" href="style.css">'';
+ "@head@" = ''
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta name="viewport" content="width=device-width">
+ <meta name="description" content="Informationen zum Stadtteil Heimfeld und seinem Stadtteilbeirat">
+ <meta name="keywords" content="Heimfeld, Stadtteil, Hamburg, Stadtteilbeirat, Beirat, Stadtteilfest, Treffpunkthaus">
+ <link rel="shortcut icon" type="image/x-icon" href="/img/Kraniche-dreh-klein.gif">
+ <script async src="redirects.js"></script>
+ '';
+ "@past-events@" = ''
+ <dl>
+ ${
+ with lib;
+ concatMapStringsSep "\n" (event: event.value) (
+ filter (event: event.start < config.published) (reverseList events)
+ )
+ }
+ </dl>
+ '';
+ "@future-events@" = ''
<dl>
- ${concatMapStringsSep "\n" (event: event.value) sorted}
+ ${
+ with lib;
+ concatMapStringsSep "\n" (event: event.value) (
+ filter (event: event.start >= config.published) events
+ )
+ }
</dl>
'';
- };
+ };
replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file;
in
{
title = "Stadtteilbeirat Heimfeld";
+ published = "2026-01-18";
events =
with lib;
listToAttrs (