fix pages with spaces

This commit is contained in:
dusk 2023-04-06 06:45:41 +03:00
parent 3d55fead09
commit b6a96ef07e
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
2 changed files with 9 additions and 4 deletions

View File

@ -82,8 +82,13 @@ in {
local ? false,
config ? {},
} @ args: let
getPath = from: name:
l.path {
name = l.strings.sanitizeDerivationName name;
path = "${toString from}/${name}";
};
postsRendered = let
path = src + "/posts";
path = "${toString src}/posts";
in
l.pipe (l.readDir path) [
(l.mapAttrsToList (
@ -99,7 +104,7 @@ in {
if date == ""
then null
else date;
content = l.readFile (parseMarkdown id (path + "/${name}"));
content = l.readFile (parseMarkdown id (getPath path name));
}
))
(l.sort (
@ -117,14 +122,14 @@ in {
))
];
pagesRendered = let
path = src + "/pages";
path = "${toString src}/pages";
in
l.mapAttrsToList
(
name: _: rec {
displayName = l.head (l.splitString "." name);
id = l.replaceStrings [" "] ["_"] displayName;
content = l.readFile (parseMarkdown id (path + "/${name}"));
content = l.readFile (parseMarkdown id (getPath path name));
}
)
(l.readDir path);