about summary refs log tree commit diff
path: root/users/Profpatsch/blog/default.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-08-07T16·57+0200
committerProfpatsch <mail@profpatsch.de>2021-11-13T00·57+0000
commit33e56abcf229cf72256787d20a0153e6185a9fc1 (patch)
tree7a53b54ec72e5628fab092ec1ca5a6cf24f215a5 /users/Profpatsch/blog/default.nix
parent1c8e55b60c774eccb01a5b42a223af5e2acd2bb8 (diff)
fix(users/Profpatsch/blog): notes toplevel rendering r/3042
The rendering of the notes/ template was done in a very roundabout way
through the routing table before. Now it’s constructed directly.

Change-Id: Iaa6157cc3f9a7e5e0ad81ab843efa988995666b2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3282
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/blog/default.nix')
-rw-r--r--users/Profpatsch/blog/default.nix21
1 files changed, 17 insertions, 4 deletions
diff --git a/users/Profpatsch/blog/default.nix b/users/Profpatsch/blog/default.nix
index 9d22e7f770c5..2a4a558cd8bf 100644
--- a/users/Profpatsch/blog/default.nix
+++ b/users/Profpatsch/blog/default.nix
@@ -16,6 +16,14 @@ let
     bins.lowdown "-s" "-Thtml" "-o" "$out" note
   ];
 
+  toplevel = [
+    {
+      route = [ "notes" ];
+      name = "Notes";
+      page = router;
+    }
+  ];
+
   notes = [
     {
       route = [ "notes" "preventing-oom" ];
@@ -29,8 +37,11 @@ let
     }
   ];
 
-  router = lib.pipe notes [
+  notesFullRoute = lib.pipe notes [
     (map (x@{route, ...}: x // { route = mkRoute route; }))
+  ];
+
+  router = lib.pipe notesFullRoute [
     (map (x: {
       name = x.route;
       value = me.netencode.gen.dwim x;
@@ -48,13 +59,15 @@ let
     "redirfd" "-w" "1" "$out"
   ] ++ cmd);
 
-  index = runExeclineStdout "index" {} [
-    "backtick" "-in" "TEMPLATE_DATA" [ cdbDumpNetencode router ]
+  index = runExeclineStdout "index" {
+    stdin = me.netencode.gen.dwim notesFullRoute;
+  } [
+    "withstdinas" "-in" "TEMPLATE_DATA"
     "pipeline" [
       bins.printf ''
         <ul>
         {{#.}}
-          <li><a href="{{key}}">{{val}}<a></li>
+          <li><a href="{{route}}">{{name}}<a></li>
         {{/.}}
         </ul>
       ''