forked from Fediversity/Fediversity
make template overrides take final and prev
This commit is contained in:
parent
1fe519c838
commit
d0c7f1cad1
|
@ -9,14 +9,12 @@ in
|
||||||
collections.news.type = cfg.content-types.article;
|
collections.news.type = cfg.content-types.article;
|
||||||
|
|
||||||
pages.index = { config, link, ... }: {
|
pages.index = { config, link, ... }: {
|
||||||
title = "Fediversity";
|
title = "Welcome to the Fediversity project";
|
||||||
description = "Fediversity web site";
|
description = "Fediversity web site";
|
||||||
summary = ''
|
summary = ''
|
||||||
This web site hosts up-to-date information about the the NGI Zero Fediversity project.
|
This web site hosts up-to-date information about the the NGI Zero Fediversity project.
|
||||||
'';
|
'';
|
||||||
body = ''
|
body = ''
|
||||||
# Welcome to the Fediversity project
|
|
||||||
|
|
||||||
${pages.fediversity.summary}
|
${pages.fediversity.summary}
|
||||||
|
|
||||||
[Learn more about Fediversity](${link pages.fediversity})
|
[Learn more about Fediversity](${link pages.fediversity})
|
||||||
|
@ -61,11 +59,7 @@ in
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
outputs.html = (cfg.templates.html.page config).override {
|
outputs.html = (cfg.templates.html.page config).override {
|
||||||
html.body.content = lib.mkForce [
|
html.head.title.text = "Fediversity";
|
||||||
# don't show the page title as a heading
|
|
||||||
(cfg.menus.main.outputs.html config)
|
|
||||||
(cfg.templates.html.markdown { inherit (config) name body; })
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,11 @@ rec {
|
||||||
result // {
|
result // {
|
||||||
override = new:
|
override = new:
|
||||||
let
|
let
|
||||||
base' = lib.recursiveUpdate base new;
|
base' =
|
||||||
|
if lib.isFunction new
|
||||||
|
then lib.recursiveUpdate base (new base' base)
|
||||||
|
else
|
||||||
|
lib.recursiveUpdate base new;
|
||||||
result' = g base';
|
result' = g base';
|
||||||
in
|
in
|
||||||
result' // {
|
result' // {
|
||||||
|
|
|
@ -27,28 +27,26 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config.name = lib.slug config.title;
|
config.name = lib.slug config.title;
|
||||||
config.outputs.html = lib.mkForce ((cfg.templates.html.page config).override {
|
config.outputs.html = lib.mkForce
|
||||||
html = {
|
((cfg.templates.html.page config).override (final: prev: {
|
||||||
# TODO: make authors always a list
|
html = {
|
||||||
head.meta.authors = if lib.isList config.author then config.author else [ config.author ];
|
# TODO: make authors always a list
|
||||||
body.content = lib.mkForce [
|
head.meta.authors = if lib.isList config.author then config.author else [ config.author ];
|
||||||
(cfg.menus.main.outputs.html config)
|
body.content = with lib; map
|
||||||
{
|
(e:
|
||||||
section = {
|
if isAttrs e && e ? section
|
||||||
heading = {
|
then
|
||||||
# TODO: i18n support
|
recursiveUpdate e
|
||||||
# TODO: structured dates
|
{
|
||||||
before = [{ p.content = "Published ${config.date}"; }];
|
section.heading = {
|
||||||
content = config.title;
|
before = [{ p.content = "Published ${config.date}"; }];
|
||||||
after = [{ p.content = "Written by ${config.author}"; }];
|
after = [{ p.content = "Written by ${config.author}"; }];
|
||||||
};
|
};
|
||||||
content = [
|
}
|
||||||
(cfg.templates.html.markdown { inherit (config) name body; })
|
else e
|
||||||
];
|
)
|
||||||
};
|
prev.html.body.content;
|
||||||
}
|
};
|
||||||
];
|
}));
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue