more structured front page

this allows for more customised styling
This commit is contained in:
Valentin Gagarin 2024-11-13 15:24:41 +01:00
parent ee6e661eaf
commit 0470af8e94

View file

@ -19,59 +19,107 @@ in
${pages.fediversity.summary} ${pages.fediversity.summary}
[Learn more about Fediversity](${link pages.fediversity}) [Learn more about Fediversity](${link pages.fediversity})
'';
# Fediversity grants 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} ${pages.grants.summary}
[Learn more about Fediversity grants](${link pages.grants}) [Learn more about Fediversity grants](${link pages.grants})
'';
# Consortium }
{
heading = "Consortium";
body = ''
The Consortium behind the Fediversity project is a cooperation between NLnet, Open Internet Discourse Foundation, NORDUnet and Tweag. The Consortium behind the Fediversity project is a cooperation between NLnet, Open Internet Discourse Foundation, NORDUnet and Tweag.
${toString (map (partner: '' ${toString (map (partner: ''
## ${partner.title} ### ${partner.title}
${partner.summary} ${partner.summary}
[Read more about ${partner.title}](${link partner}) [Read more about ${partner.title}](${link partner})
'') (with pages; [ nlnet oid tweag nordunet ]))} '') (with pages; [ nlnet oid tweag nordunet ]))}
'';
# Fediverse explained }
{
heading = "Fediverse explained";
body = ''
${toString (map (role: '' ${toString (map (role: ''
## ${role.title} ### ${role.title}
${role.summary} ${role.summary}
[Read more about ${role.title}](${link role}) [Read more about ${role.title}](${link role})
'') (with pages; [ individuals developers european-commission ]))} '') (with pages; [ individuals developers european-commission ]))}
'';
# News }
]);
${ };
}
]
++
(map to-section [
{
heading = "News";
attrs = { class = [ "collection" ]; };
body =
let let
sorted = with lib; reverseList (sortOn (entry: entry.date) cfg.collections.news.entry); sorted = with lib; reverseList (sortOn (entry: entry.date) cfg.collections.news.entry);
in in
lib.join "\n" (map (article: '' lib.join "\n" (map
(article: ''
- ${article.date} [${article.title}](${link article}) - ${article.date} [${article.title}](${link article})
'') sorted) '')
sorted);
} }
{
# Events heading = "Events";
attrs = { class = [ "collection" ]; };
${ body =
let let
sorted = with lib; reverseList (sortOn (entry: entry.start-date) cfg.collections.events.entry); sorted = with lib; reverseList (sortOn (entry: entry.start-date) cfg.collections.events.entry);
in in
lib.join "\n" (map (article: '' lib.join "\n" (map
(article: ''
- ${article.start-date} [${article.title}](${link article}) - ${article.start-date} [${article.title}](${link article})
'') sorted) '')
sorted);
} }
''; ]);
outputs.html = (cfg.templates.html.page config).override {
html.head.title.text = "Fediversity";
}; };
});
}; };
} }