about summary refs log tree commit diff
path: root/web/blog/fragments.nix
diff options
context:
space:
mode:
Diffstat (limited to 'web/blog/fragments.nix')
-rw-r--r--web/blog/fragments.nix13
1 files changed, 6 insertions, 7 deletions
diff --git a/web/blog/fragments.nix b/web/blog/fragments.nix
index 19d62fa474..20fb879d9e 100644
--- a/web/blog/fragments.nix
+++ b/web/blog/fragments.nix
@@ -8,18 +8,16 @@
 
 let
   inherit (builtins) filter map hasAttr replaceStrings;
-  inherit (pkgs) runCommandNoCC writeText;
+  inherit (pkgs) runCommand writeText;
   inherit (depot.nix) renderMarkdown;
 
-  staticUrl = "https://static.tvl.fyi/${depot.web.static.drvHash}";
-
   # Generate a post list for all listed, non-draft posts.
   isDraft = post: (hasAttr "draft" post) && post.draft;
   isUnlisted = post: (hasAttr "listed" post) && !post.listed;
 
   escape = replaceStrings [ "<" ">" "&" "'" ] [ "&lt;" "&gt;" "&amp;" "&#39;" ];
 
-  header = name: title: ''
+  header = name: title: staticUrl: ''
     <!DOCTYPE html>
     <head>
       <meta charset="utf-8">
@@ -61,8 +59,8 @@ let
     <hr>
   '';
 
-  renderPost = { name, footer, ... }: post: runCommandNoCC "${post.key}.html" { } ''
-    cat ${writeText "header.html" (header name post.title)} > $out
+  renderPost = { name, footer, staticUrl ? "https://static.tvl.fyi/${depot.web.static.drvHash}", ... }: post: runCommand "${post.key}.html" { } ''
+    cat ${writeText "header.html" (header name post.title staticUrl)} > $out
 
     # Write the post title & date
     echo '<article><h2 class="inline">${escape post.title}</h2>' >> $out
@@ -73,6 +71,7 @@ let
       then ''date --date="@${toString post.updated}" '+ (updated %Y-%m-%d)' >> $out''
       else ""
     }
+    ${if post ? author then "echo ' by ${post.author}' >> $out" else ""}
     echo '</aside>' >> $out
 
     ${
@@ -85,7 +84,7 @@ let
     }
 
     # Write the actual post through cheddar's about-filter mechanism
-    cat ${renderMarkdown post.content} >> $out
+    cat ${renderMarkdown { path = post.content; tagfilter = post.tagfilter or true; }} >> $out
     echo '</article>' >> $out
 
     cat ${writeText "footer.html" (fullFooter footer)} >> $out