add index content
This commit is contained in:
parent
9c6c7d39dc
commit
f2b5bc28a9
12
pkgs-lib.nix
12
pkgs-lib.nix
@ -91,6 +91,12 @@ in {
|
|||||||
name = l.strings.sanitizeDerivationName name;
|
name = l.strings.sanitizeDerivationName name;
|
||||||
path = "${toString from}/${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
|
postsRendered = let
|
||||||
path = "${toString src}/posts";
|
path = "${toString src}/posts";
|
||||||
in
|
in
|
||||||
@ -148,7 +154,8 @@ in {
|
|||||||
then "http://localhost:8080"
|
then "http://localhost:8080"
|
||||||
else args.config.baseurl or (throw "Need baseurl");
|
else args.config.baseurl or (throw "Need baseurl");
|
||||||
|
|
||||||
context = {
|
context =
|
||||||
|
{
|
||||||
inherit lib baseurl;
|
inherit lib baseurl;
|
||||||
inherit (args) config;
|
inherit (args) config;
|
||||||
posts = postsRendered;
|
posts = postsRendered;
|
||||||
@ -159,6 +166,9 @@ in {
|
|||||||
Allow: /
|
Allow: /
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
// l.optionalAttrs (indexRendered != null) {
|
||||||
|
indexContent = indexRendered;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(templater context).site;
|
(templater context).site;
|
||||||
|
Loading…
Reference in New Issue
Block a user