implement indexContent and resources support

This commit is contained in:
dusk 2022-07-30 13:29:56 +03:00
parent 8c562cd257
commit 9f5e0095a4
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -9,7 +9,7 @@
... ...
} @ context: let } @ context: let
inherit (utils) readFile mapAttrsToList mapAttrs tags fetchGit map elemAt foldl' concatStrings genAttrs toString; inherit (utils) readFile mapAttrsToList mapAttrs tags fetchGit map elemAt foldl' concatStrings genAttrs toString;
inherit (pkgs.lib) optional length splitString nameValuePair toInt range mapAttrs'; inherit (pkgs.lib) optionalAttrs optional length splitString nameValuePair toInt range mapAttrs';
stylesheets = map tags.mkStylesheet [ stylesheets = map tags.mkStylesheet [
"https://unpkg.com/purecss@2.0.6/build/pure-min.css" "https://unpkg.com/purecss@2.0.6/build/pure-min.css"
@ -86,6 +86,8 @@
]} ]}
''; '';
indexPage = mkPage (context.indexContent or postsSectionContent);
stylesheet = with utils.css; let stylesheet = with utils.css; let
marginMobile = { marginMobile = {
margin-left = "3%"; margin-left = "3%";
@ -157,9 +159,10 @@ in {
site = site =
site site
// { // {
"index.html" = mkPage postsSectionContent; "index.html" = indexPage;
"404.html" = mkPage (tags.h1 "No such page"); "404.html" = mkPage (tags.h1 "No such page");
"site.css" = stylesheet; "site.css" = stylesheet;
} }
// (mapAttrs (name: value: {"index.html" = mkPage value;}) pages); // (mapAttrs (name: value: {"index.html" = mkPage value;}) pages)
// optionalAttrs (context ? resources) {inherit (context) resources;};
} }