From ad1e1930679b20e07dfbebea9ff914b451d6ba3d 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. --- content/default.nix | 8 +------- content/fediversity.nix | 3 --- content/grants.nix | 3 --- content/news/nordunet-conference.nix | 3 --- content/news/project-launch.nix | 3 --- content/news/publicspaces-conference-2024.nix | 3 --- content/news/tech-session.nix | 3 --- content/news/website-launch.nix | 3 --- content/partners/nlnet.nix | 3 --- content/partners/nordunet.nix | 3 --- content/partners/oid.nix | 3 --- content/partners/tweag.nix | 3 --- presentation/default.nix | 3 ++- structure/default.nix | 4 ++++ structure/document.nix | 13 ++++++++++++- 15 files changed, 19 insertions(+), 42 deletions(-) diff --git a/content/default.nix b/content/default.nix index c4d0f58c..5253b957 100644 --- a/content/default.nix +++ b/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/content/fediversity.nix b/content/fediversity.nix index 1762d7b0..4e8f2ccb 100644 --- a/content/fediversity.nix +++ b/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/content/grants.nix b/content/grants.nix index a231b0c5..2dfe1344 100644 --- a/content/grants.nix +++ b/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/content/news/nordunet-conference.nix b/content/news/nordunet-conference.nix index 8fb6d631..938a5e08 100644 --- a/content/news/nordunet-conference.nix +++ b/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/content/news/project-launch.nix b/content/news/project-launch.nix index 05edc4c7..d6f4cbd1 100644 --- a/content/news/project-launch.nix +++ b/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/content/news/publicspaces-conference-2024.nix b/content/news/publicspaces-conference-2024.nix index b298cc4a..af0a4f29 100644 --- a/content/news/publicspaces-conference-2024.nix +++ b/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/content/news/tech-session.nix b/content/news/tech-session.nix index 9b5267d4..bb572961 100644 --- a/content/news/tech-session.nix +++ b/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/content/news/website-launch.nix b/content/news/website-launch.nix index ae79c073..d17cf04c 100644 --- a/content/news/website-launch.nix +++ b/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/content/partners/nlnet.nix b/content/partners/nlnet.nix index dfeae815..b7aaf102 100644 --- a/content/partners/nlnet.nix +++ b/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/content/partners/nordunet.nix b/content/partners/nordunet.nix index 407438f3..6c660ae4 100644 --- a/content/partners/nordunet.nix +++ b/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/content/partners/oid.nix b/content/partners/oid.nix index 7c9752ec..d1a0e320 100644 --- a/content/partners/oid.nix +++ b/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/content/partners/tweag.nix b/content/partners/tweag.nix index a0db68cc..7013bed9 100644 --- a/content/partners/tweag.nix +++ b/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/presentation/default.nix b/presentation/default.nix index 69fa34c2..4448fcb6 100644 --- a/presentation/default.nix +++ b/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/structure/default.nix b/structure/default.nix index 6c2f5419..6af794ae 100644 --- a/structure/default.nix +++ b/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/structure/document.nix b/structure/document.nix index 285e8ac7..632a6511 100644 --- a/structure/document.nix +++ b/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 {