handle pages and posts not existing

This commit is contained in:
dusk 2023-04-06 06:58:20 +03:00
parent c6bd196fdc
commit 4ffd5d4fa5
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA

View File

@ -94,6 +94,8 @@ in {
postsRendered = let postsRendered = let
path = "${toString src}/posts"; path = "${toString src}/posts";
in in
if l.pathExists postsRendered
then
l.pipe (l.readDir path) [ l.pipe (l.readDir path) [
(l.mapAttrsToList ( (l.mapAttrsToList (
name: _: let name: _: let
@ -124,10 +126,13 @@ in {
then true then true
else !(d 0 > od 0 && d 1 > od 1 && d 2 > od 2) else !(d 0 > od 0 && d 1 > od 1 && d 2 > od 2)
)) ))
]; ]
else [];
pagesRendered = let pagesRendered = let
path = "${toString src}/pages"; path = "${toString src}/pages";
in in
if l.pathExists path
then
l.mapAttrsToList l.mapAttrsToList
( (
name: _: rec { name: _: rec {
@ -136,7 +141,8 @@ in {
content = l.readFile (parseMarkdown id (getPath path name)); content = l.readFile (parseMarkdown id (getPath path name));
} }
) )
(l.readDir path); (l.readDir path)
else [];
baseurl = baseurl =
if local if local
then "http://localhost:8080" then "http://localhost:8080"