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;
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user