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.
This commit is contained in:
Valentin Gagarin 2024-11-13 15:24:41 +01:00 committed by Valentin Gagarin
parent 7efd5b8317
commit 059ebc2291
15 changed files with 19 additions and 42 deletions

View file

@ -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.

View file

@ -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 scenarios where consistent behaviour, stability and configurability matter.

View file

@ -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 euros which should get you on your way.

View file

@ -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.

View file

@ -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.

View file

@ -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!).

View file

@ -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.

View file

@ -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.

View file

@ -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 1980s, NLnet has been financially supporting the open internet since 1997.

View file

@ -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.

View file

@ -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:

View file

@ -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.
'';

View file

@ -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);

View file

@ -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
{

View file

@ -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 {