about summary refs log tree commit diff
path: root/users/tazjin/blog
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-04-02T13·35+0200
committertazjin <mail@tazj.in>2021-04-02T13·44+0000
commit4450003bd7385a29a28f83f3f7a3d2f57615e9ff (patch)
treeaa81e6697ab67ea610e852f98b855176fe68a180 /users/tazjin/blog
parent817cd6f166af88b73ff7b80e7e70a0689951f731 (diff)
feat(tazjin/blog): Add distinction between published & updated times r/2402
Fixes a long-standing todo by adding an additional field for the time
at which a post was updated, and handling this in both site
generation (to note the update date after the publish date) and in
Atom feed generation (by populating both the updated and published
fields).

Change-Id: If80db43459b2a0c77eea4dde7255651b5d6cd64b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2766
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/blog')
-rw-r--r--users/tazjin/blog/default.nix3
-rw-r--r--users/tazjin/blog/fragments.nix5
2 files changed, 8 insertions, 0 deletions
diff --git a/users/tazjin/blog/default.nix b/users/tazjin/blog/default.nix
index 2232be2736..a5254b5496 100644
--- a/users/tazjin/blog/default.nix
+++ b/users/tazjin/blog/default.nix
@@ -15,6 +15,9 @@ let
     title = string;
     date = int;
 
+    # Optional time at which this post was last updated.
+    updated = option int;
+
     # Path to the Markdown file containing the post content.
     content = path;
 
diff --git a/users/tazjin/blog/fragments.nix b/users/tazjin/blog/fragments.nix
index 78a64afa39..98028fad70 100644
--- a/users/tazjin/blog/fragments.nix
+++ b/users/tazjin/blog/fragments.nix
@@ -74,6 +74,11 @@ let
     echo '<article><h2 class="inline">${escape post.title}</h2>' >> $out
     echo '<aside class="date">' >> $out
     date --date="@${toString post.date}" '+%Y-%m-%d' >> $out
+    ${
+      if post ? updated
+      then ''date --date="@${toString post.updated}" '+ (updated %Y-%m-%d)' >> $out''
+      else ""
+    }
     echo '</aside>' >> $out
 
     ${