nte/example/posts/index.nix

36 lines
672 B
Nix
Raw Permalink Normal View History

2024-05-22 21:55:06 +02:00
{
getEntry,
2024-05-22 21:55:06 +02:00
pkgs,
...
}: let
2024-05-22 21:55:06 +02:00
inherit (pkgs) lib;
inherit (lib.lists) map;
inherit (lib.strings) concatStrings;
in {
template = "base";
head = /*html*/''
<title>nte posts</title>
<link rel="stylesheet" href="/posts/index.css" />
'';
body = let
postItem = post: /*html*/''
<div class="post-item">
<div class="post-title">
<a href="/${post.file}"><h2>${post.title}</h2></a>
</div>
<h3>${post.created}</h3>
</div>
'';
in /*html*/''
<div id="posts">
${concatStrings (map (postFile: postItem (getEntry postFile))
2024-05-22 21:55:06 +02:00
[
./test.nix
]
)}
</div>
'';
}