From ab36912ee135d4897730b31d6e767d51bcf54e40 Mon Sep 17 00:00:00 2001 From: Valentin Date: Tue, 16 Dec 2025 21:42:38 +0100 Subject: Titel auf allen Seiten aus Konfiguration generiert --- www/framework/default.nix | 6 ++++++ www/html.nix | 3 ++- www/html/datenschutz.html | 2 +- www/html/impressum.html | 2 +- www/html/index.html | 2 +- www/html/vergangene-termine.html | 2 +- www/index.nix | 33 +++++++++++++++++++++++++++++++++ 7 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 www/index.nix (limited to 'www') diff --git a/www/framework/default.nix b/www/framework/default.nix index 92e1ed8..0cc9049 100644 --- a/www/framework/default.nix +++ b/www/framework/default.nix @@ -19,6 +19,12 @@ in default = { }; }; + title = mkOption { + description = "Titel, der bei allen Seiten vorangestellt wird"; + type = types.singleLineStr; + readOnly = true; + }; + files = mkOption { description = '' Dateien, aus denen die Website besteht, als Abbildung vom Dateipfad zum Inhalt diff --git a/www/html.nix b/www/html.nix index 6e48e2f..729ea12 100644 --- a/www/html.nix +++ b/www/html.nix @@ -9,10 +9,11 @@ inherit (lib) mkOption types; in { + title = "Stadtteilbeirat Heimfeld"; files = let root = ./html; - files = lib.fileset.toList root; + files = with lib.fileset; toList root; redirects = with lib; mapAttrsToList diff --git a/www/html/datenschutz.html b/www/html/datenschutz.html index e5876e7..b9d1963 100644 --- a/www/html/datenschutz.html +++ b/www/html/datenschutz.html @@ -4,7 +4,7 @@ - Datenschutz + @title@ – Datenschutz diff --git a/www/html/impressum.html b/www/html/impressum.html index e6872db..cdf864e 100644 --- a/www/html/impressum.html +++ b/www/html/impressum.html @@ -4,7 +4,7 @@ - Impressum + @title@ – Impressum diff --git a/www/html/index.html b/www/html/index.html index 967522b..00ec727 100644 --- a/www/html/index.html +++ b/www/html/index.html @@ -6,7 +6,7 @@ - Stadtteilbeirat Heimfeld + @title@ diff --git a/www/html/vergangene-termine.html b/www/html/vergangene-termine.html index cc9c576..29b711c 100644 --- a/www/html/vergangene-termine.html +++ b/www/html/vergangene-termine.html @@ -6,7 +6,7 @@ - Stadtteilbeirat Heimfeld – Vergangene Termine + @title@ – Vergangene Termine diff --git a/www/index.nix b/www/index.nix new file mode 100644 index 0000000..0d84ec3 --- /dev/null +++ b/www/index.nix @@ -0,0 +1,33 @@ +{ self, ... }: +{ + perSystem = + { ... }: + { + websites.${self.domain} = + { config, lib, ... }: + let + inherit (lib) mkOption types; + replacements = { + "@title@" = config.title; + }; + replace = file: with lib; replaceStrings (attrNames replacements) (attrValues replacements) file; + in + { + files = + with lib; + listToAttrs ( + map + (path: rec { + name = baseNameOf path; + value = with builtins; toFile "index.html" (replace (readFile path)); + }) + [ + ./html/index.html + ./html/vergangene-termine.html + ./html/impressum.html + ./html/datenschutz.html + ] + ); + }; + }; +} -- cgit v1.2.3