add index content

This commit is contained in:
dusk 2023-04-06 07:07:05 +03:00
parent 9c6c7d39dc
commit f2b5bc28a9
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -91,6 +91,12 @@ in {
name = l.strings.sanitizeDerivationName name;
path = "${toString from}/${name}";
};
indexRendered = let
path = "${toString src}/index.md";
in
if l.pathExists path
then l.readFile (parseMarkdown "index.html" path)
else null;
postsRendered = let
path = "${toString src}/posts";
in
@ -148,7 +154,8 @@ in {
then "http://localhost:8080"
else args.config.baseurl or (throw "Need baseurl");
context = {
context =
{
inherit lib baseurl;
inherit (args) config;
posts = postsRendered;
@ -159,6 +166,9 @@ in {
Allow: /
'';
};
}
// l.optionalAttrs (indexRendered != null) {
indexContent = indexRendered;
};
in
(templater context).site;