From 059ebc229148575e9dd06c1df13315ae541afe60 Mon Sep 17 00:00:00 2001 From: valentin gagarin Date: Wed, 13 Nov 2024 15:24:41 +0100 Subject: [PATCH] set a default location for documents it turns out that setting a value appends to that. the default only needs to be overridden when the symbolic name of the document changes. while there's a chance people will inadvertently break links that way, it's requires less up-front knowledge to work with. --- website/content/default.nix | 8 +------- website/content/fediversity.nix | 3 --- website/content/grants.nix | 3 --- website/content/news/nordunet-conference.nix | 3 --- website/content/news/project-launch.nix | 3 --- .../content/news/publicspaces-conference-2024.nix | 3 --- website/content/news/tech-session.nix | 3 --- website/content/news/website-launch.nix | 3 --- website/content/partners/nlnet.nix | 3 --- website/content/partners/nordunet.nix | 3 --- website/content/partners/oid.nix | 3 --- website/content/partners/tweag.nix | 3 --- website/presentation/default.nix | 3 ++- website/structure/default.nix | 4 ++++ website/structure/document.nix | 13 ++++++++++++- 15 files changed, 19 insertions(+), 42 deletions(-) diff --git a/website/content/default.nix b/website/content/default.nix index c4d0f58..5253b95 100644 --- a/website/content/default.nix +++ b/website/content/default.nix @@ -5,16 +5,10 @@ in { imports = lib.nixFiles ./.; - collections.news = { - type = config.content-types.article; - prefixes = [ "news" ]; - }; + collections.news.type = config.content-types.article; pages.index = { link, ... }: { title = "Fediversity"; - locations = [ - "index.html" - ]; description = "Fediversity web site"; summary = '' This web site hosts up-to-date information about the the NGI Zero Fediversity project. diff --git a/website/content/fediversity.nix b/website/content/fediversity.nix index 1762d7b..4e8f2cc 100644 --- a/website/content/fediversity.nix +++ b/website/content/fediversity.nix @@ -6,9 +6,6 @@ summary = '' The Fediversity Project is a comprehensive effort to bring easy-to-use, hosted cloud services that have service portability and personal freedom at their core to everyone. ''; - locations = [ - "fediversity.html" - ]; body = '' Fediversity is a comprehensive effort to bring easy-to-use, hosted cloud services with service portability and personal freedom at their core to everyone. It wants to provide everyone with high-quality, secure IT systems for everyday use. Without tracking, without exploitation, in a way that runs everywhere and scales effortlessly. Fediversity is based on NixOS, a disruptive Linux distribution with a unique approach to package and configuration management. Built on top of the Nix package manager, NixOS is completely declarative, makes upgrading systems reliable, and has many other advantages. Because it is reproducible, it is ideally suited for complex deployment scenario’s where consistent behaviour, stability and configurability matter. diff --git a/website/content/grants.nix b/website/content/grants.nix index a231b0c..2dfe134 100644 --- a/website/content/grants.nix +++ b/website/content/grants.nix @@ -2,9 +2,6 @@ { pages.grants = { title = "Grants"; - locations = [ - "grants.html" - ]; description = "How to apply for grants as part of the Fediversity Project"; summary = '' Fediversity will award 450 000 euro in small to medium-size R&D grants towards solutions that bring the next generation of social networks closer. We are seeking project proposals between 5.000 and 50.000 euro’s — which should get you on your way. diff --git a/website/content/news/nordunet-conference.nix b/website/content/news/nordunet-conference.nix index 8fb6d63..938a5e0 100644 --- a/website/content/news/nordunet-conference.nix +++ b/website/content/news/nordunet-conference.nix @@ -5,9 +5,6 @@ description = "Report from the NORDUnet Conference 2024"; date = "2024-09-17"; author = "Laurens Hof"; - locations = [ - "nordunet-conference-2024.html" - ]; body = '' Fediversity was represented in Bergen at the Nordunet Conference for 2024, with both the Internet Discourse Foundation and Nordunet themselves being present. This was a great opportunity for the different organisations in the consortium to meet with each other and exchange ideas. diff --git a/website/content/news/project-launch.nix b/website/content/news/project-launch.nix index 05edc4c..d6f4cbd 100644 --- a/website/content/news/project-launch.nix +++ b/website/content/news/project-launch.nix @@ -5,9 +5,6 @@ description = "The Fediversity project has officially been announced"; date = "2024-01-01"; author = "Laurens Hof"; - locations = [ - "fediversity-announced.html" - ]; body = '' The Consortium behind the Fediversity project announces that the project has officially been started. NLnet, Tweag, NorduNet and the Open Internet Discourse Foundation are working together to build a new service for cloud hosters. diff --git a/website/content/news/publicspaces-conference-2024.nix b/website/content/news/publicspaces-conference-2024.nix index b298cc4..af0a4f2 100644 --- a/website/content/news/publicspaces-conference-2024.nix +++ b/website/content/news/publicspaces-conference-2024.nix @@ -5,9 +5,6 @@ description = "Report from the PublicSpaces Conference 2024 - 'Take Back the Internet'"; date = "2024-07-30"; author = "Laurens Hof"; - locations = [ - "publicspaces-conference-2024.html" - ]; body = '' PublicSpaces and Waag Futurelabs recently held their yearly conference in Amsterdam, titled 'Taking Back the Internet'. PublicSpaces is a network of public organisations fighting for an internet based on public values. The Fediversity Project attended, to share ideas, and learn more about how people and organisations think about an ethical internet. If you are interested, you can view all sessions [here](https://conference.publicspaces.net/en/archive/pubconf2024) (hosted on PeerTube!). diff --git a/website/content/news/tech-session.nix b/website/content/news/tech-session.nix index 9b5267d..bb57296 100644 --- a/website/content/news/tech-session.nix +++ b/website/content/news/tech-session.nix @@ -5,9 +5,6 @@ description = "Fediversity tech session - NixOS and Kubernetes"; date = "2024-08-05"; author = "Laurens Hof"; - locations = [ - "tech-session.html" - ]; body = '' Recently Fediversity hosted a tech session on NixOS and Kubernetes. We invited people within the community to discuss some design considerations of the Fediversity project with us. diff --git a/website/content/news/website-launch.nix b/website/content/news/website-launch.nix index ae79c07..d17cf04 100644 --- a/website/content/news/website-launch.nix +++ b/website/content/news/website-launch.nix @@ -5,9 +5,6 @@ description = "Announcing our new website for the Fediversity project"; date = "2024-05-15"; author = "Laurens Hof"; - locations = [ - "website-launch.html" - ]; body = '' We are pleased to introduce the launch of our new website dedicated to the Fediversity project. diff --git a/website/content/partners/nlnet.nix b/website/content/partners/nlnet.nix index dfeae81..b7aaf10 100644 --- a/website/content/partners/nlnet.nix +++ b/website/content/partners/nlnet.nix @@ -6,9 +6,6 @@ summary = '' NLnet supports organisations and people who contribute to an open internet for all. They fund projects that help fix the internet through open hardware, open software, open standards, open science and open data. ''; - locations = [ - "nlnet.html" - ]; body = '' The NLnet Foundation supports organisations and people who contribute to an open internet for all. NLnet funds projects that help fix the internet through open hardware, open software, open standards, open science and open data. After its historical contribution to the early internet in Europe in the 1980’s, NLnet has been financially supporting the open internet since 1997. diff --git a/website/content/partners/nordunet.nix b/website/content/partners/nordunet.nix index 407438f..6c660ae 100644 --- a/website/content/partners/nordunet.nix +++ b/website/content/partners/nordunet.nix @@ -6,9 +6,6 @@ description = '' NORDUnet is a collaboration of the National Research and Education Networks (NREN) of the Nordic countries. ''; - locations = [ - "nordunet.html" - ]; body = '' NORDUnet connects universities and research institutions across Denmark, Finland, Iceland, Norway, and Sweden. It enables collaboration, data sharing, and access to online resources for academic and research purposes. diff --git a/website/content/partners/oid.nix b/website/content/partners/oid.nix index 7c9752e..d1a0e32 100644 --- a/website/content/partners/oid.nix +++ b/website/content/partners/oid.nix @@ -7,9 +7,6 @@ description = '' The Open Internet Discourse Foundation (OID) is founded on the belief that everyone deserves the freedom to express themselves and use the internet without constraints, and is committed to help build a better internet where individuals can truly be who they are. ''; - locations = [ - "oid.html" - ]; body = '' The three pillars that are at the core of the OID Foundation: diff --git a/website/content/partners/tweag.nix b/website/content/partners/tweag.nix index a0db68c..7013bed 100644 --- a/website/content/partners/tweag.nix +++ b/website/content/partners/tweag.nix @@ -6,9 +6,6 @@ description = '' Tweag is the open source program office (OSPO) of Modus Create, and has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers ''; - locations = [ - "tweag.html" - ]; body = '' Tweag is the open source program office (OSPO) of Modus Create, a global digital consulting firm that helps enterprises build competitive advantage through digital innovation. Tweagers are leading contributors to several open source projects — from functional programming languages to cross-platform frameworks. Tweag has extensive experience working with Nix, and many people at the forefront of the Nix community are Tweagers. ''; diff --git a/website/presentation/default.nix b/website/presentation/default.nix index 69fa34c..4448fcb 100644 --- a/website/presentation/default.nix +++ b/website/presentation/default.nix @@ -79,7 +79,8 @@ in in with lib; foldl (acc: elem: acc // { - "${head elem.locations}" = builtins.toFile "${elem.name}.html" elem.outputs.html; + # TODO: we may or may not want to enforce the mapping of file types to output file name suffixes + "${head elem.locations}.html" = builtins.toFile "${elem.name}.html" elem.outputs.html; }) { } (pages ++ collections); diff --git a/website/structure/default.nix b/website/structure/default.nix index 6c2f541..6af794a 100644 --- a/website/structure/default.nix +++ b/website/structure/default.nix @@ -58,9 +58,13 @@ in The first element is the canonical location. All other elements are used to create redirects to the canonical location. + + The default entry is the symbolic name of the collection. + When changing the symbolic name, append the old one to your custom list and use `lib.mkForce` to make sure the default element will be overridden. ''; type = with types; nonEmptyListOf str; example = [ "." ]; + default = [ config.name ]; }; entry = mkOption { diff --git a/website/structure/document.nix b/website/structure/document.nix index 285e8ac..632a651 100644 --- a/website/structure/document.nix +++ b/website/structure/document.nix @@ -21,11 +21,19 @@ in description = '' List of historic output locations for the resulting file + Elements are relative paths to output files, without suffix. + The suffix will be added depending on output file type. + The first element is the canonical location. All other elements are used to create redirects to the canonical location. + + The default entry is the symbolic name of the document. + When changing the symbolic name, append the old one to your custom list and use `lib.mkForce` to make sure the default element will be overridden. ''; type = with types; nonEmptyListOf str; apply = config.process-locations; + example = [ "about/overview" "index" ]; + default = [ config.name ]; }; process-locations = mkOption { description = "Function to post-process the output locations of contained document"; @@ -35,7 +43,10 @@ in link = mkOption { description = "Helper function for transparent linking to other pages"; type = with types; functionTo str; - default = target: with lib; relativePath config.outPath target.outPath; + # TODO: we may want links to other representations, + # and currently the mapping of output types to output file + # names is soft. + default = target: with lib; "${relativePath config.outPath target.outPath}.html"; }; # TODO: may not need it when using `link`; could repurpose it to render the default template outPath = mkOption {