From 457f0adee7e7d3232f5b452335aa931279a61b4d Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:41 +0100 Subject: [PATCH] more structured front page this allows for more customised styling --- website/content/default.nix | 154 +++++++++++++++++++++++------------- 1 file changed, 101 insertions(+), 53 deletions(-) diff --git a/website/content/default.nix b/website/content/default.nix index 5ad084d7..6cd93043 100644 --- a/website/content/default.nix +++ b/website/content/default.nix @@ -19,59 +19,107 @@ in ${pages.fediversity.summary} [Learn more about Fediversity](${link pages.fediversity}) - - # Fediversity grants - - ${pages.grants.summary} - - [Learn more about Fediversity grants](${link pages.grants}) - - # Consortium - - The Consortium behind the Fediversity project is a cooperation between NLnet, Open Internet Discourse Foundation, NORDUnet and Tweag. - - ${toString (map (partner: '' - ## ${partner.title} - - ${partner.summary} - - [Read more about ${partner.title}](${link partner}) - '') (with pages; [ nlnet oid tweag nordunet ]))} - - # Fediverse explained - - ${toString (map (role: '' - ## ${role.title} - - ${role.summary} - - [Read more about ${role.title}](${link role}) - '') (with pages; [ individuals developers european-commission ]))} - - # News - - ${ - let - sorted = with lib; reverseList (sortOn (entry: entry.date) cfg.collections.news.entry); - in - lib.join "\n" (map (article: '' - - ${article.date} [${article.title}](${link article}) - '') sorted) - } - - # Events - - ${ - let - sorted = with lib; reverseList (sortOn (entry: entry.start-date) cfg.collections.events.entry); - in - lib.join "\n" (map (article: '' - - ${article.start-date} [${article.title}](${link article}) - '') sorted) - } ''; - outputs.html = (cfg.templates.html.page config).override { - html.head.title.text = "Fediversity"; - }; + outputs.html = (cfg.templates.html.page config).override (final: prev: { + html = { + head.title.text = "Fediversity"; + body.content = + let + prev-content = prev.html.body.content; + to-section = { heading, body, attrs ? { } }: { + section = { + heading.content = heading; + inherit attrs; + content = [ + (cfg.templates.html.markdown { + name = "${config.name}-${lib.slug heading}"; + inherit body; + }) + ]; + }; + }; + in + [ + (lib.head prev-content) # header + { + section = { + attrs = { }; + heading.content = config.title; + content = [ + (cfg.templates.html.markdown { inherit (config) name body; }) + ] + ++ + (map to-section [ + { + heading = "Fediversity grants"; + body = '' + ${pages.grants.summary} + + [Learn more about Fediversity grants](${link pages.grants}) + ''; + } + { + heading = "Consortium"; + body = '' + The Consortium behind the Fediversity project is a cooperation between NLnet, Open Internet Discourse Foundation, NORDUnet and Tweag. + + ${toString (map (partner: '' + ### ${partner.title} + + ${partner.summary} + + [Read more about ${partner.title}](${link partner}) + '') (with pages; [ nlnet oid tweag nordunet ]))} + ''; + } + { + heading = "Fediverse explained"; + body = '' + ${toString (map (role: '' + ### ${role.title} + + ${role.summary} + + [Read more about ${role.title}](${link role}) + '') (with pages; [ individuals developers european-commission ]))} + ''; + } + ]); + }; + } + ] + ++ + (map to-section [ + { + heading = "News"; + attrs = { class = [ "collection" ]; }; + body = + let + sorted = with lib; reverseList (sortOn (entry: entry.date) cfg.collections.news.entry); + in + lib.join "\n" (map + (article: '' + - ${article.date} [${article.title}](${link article}) + '') + sorted); + } + { + heading = "Events"; + attrs = { class = [ "collection" ]; }; + body = + let + sorted = with lib; reverseList (sortOn (entry: entry.start-date) cfg.collections.events.entry); + in + lib.join "\n" (map + (article: '' + - ${article.start-date} [${article.title}](${link article}) + '') + sorted); + } + ]); + }; + + }); }; + }