about summary refs log tree commit diff
path: root/web/blog/fragments.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-02-08T13·47+0000
committerVincent Ambo <tazjin@google.com>2020-02-08T13·47+0000
commit8e9fb739582b5ed871522826ea145f4a9dac2777 (patch)
treeeb6b58fc4f68f2943b30a218040cdf019b26a776 /web/blog/fragments.nix
parentcc2c130352eddb78c8b690320f0a765bb77b5bf6 (diff)
refactor(web/blog): Use timestamps for dates instead of strings r/486
This lets me easily create an ordered list of entries if the homepage
is designed to list both blog posts and other content.
Diffstat (limited to 'web/blog/fragments.nix')
-rw-r--r--web/blog/fragments.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/web/blog/fragments.nix b/web/blog/fragments.nix
index 2c9127b7f713..4af642c01e24 100644
--- a/web/blog/fragments.nix
+++ b/web/blog/fragments.nix
@@ -51,9 +51,13 @@ let
   renderPost = post: runCommandNoCC "${post.key}.html" {} ''
     cat ${toFile "header.html" (header post.title)} > $out
 
-    # Write the actual post
+    # Write the post title & date
     echo '<article><h2 class="inline">${escape post.title}</h2>' >> $out
-    echo '<aside class="date">${post.date}</aside>' >> $out
+    echo '<aside class="date">' >> $out
+    date --date="@${toString post.date}" '+%Y-%m-%d' >> $out
+    echo '</aside>' >> $out
+
+    # Write the actual post through cheddar's about-filter mechanism
     cat ${post.content} | ${pkgs.tools.cheddar}/bin/cheddar --about-filter ${post.content} >> $out
     echo '</article>' >> $out