about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-04-02T13·40+0200
committertazjin <mail@tazj.in>2021-04-02T13·44+0000
commitdc9a1754d54aa9890bc6d3f9de856ba6d11579eb (patch)
treec73b2d9b7c5af9f04b1057b909fe8bc7cfc0f305
parent4450003bd7385a29a28f83f3f7a3d2f57615e9ff (diff)
fix(tazjin/homepage): Use most recent entry update time for feed r/2403
This drops the annoying usage of builtins.currenTime, which means that
my website stops constantly rebuilding.

Change-Id: I44294b06588673846f473beb6533a5fa3410a1bd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2767
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
-rw-r--r--users/tazjin/homepage/feed.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/users/tazjin/homepage/feed.nix b/users/tazjin/homepage/feed.nix
index 3c0cc06f1044..40650f678ba1 100644
--- a/users/tazjin/homepage/feed.nix
+++ b/users/tazjin/homepage/feed.nix
@@ -4,8 +4,8 @@
 with depot.nix.yants;
 
 let
-  inherit (builtins) map readFile sort;
-  inherit (lib) singleton;
+  inherit (builtins) map readFile sort foldl';
+  inherit (lib) max singleton;
   inherit (pkgs) writeText;
   inherit (depot.users.tazjin) atom-feed blog renderMarkdown;
 
@@ -37,12 +37,13 @@ let
 
   allEntries = (map postToEntry blog.posts) ++ (map pageEntryToEntry pageEntries);
 
+  mostRecentlyUpdated = foldl' max 0 (map (e: e.updated) allEntries);
+
   feed = {
     id = "https://tazj.in/";
     title = "tazjin's interblag";
     subtitle = "my posts, projects and other interesting things";
-    # TODO(tazjin): Take the most recently updated entry time instead.
-    updated = builtins.currentTime;
+    updated = mostRecentlyUpdated;
     rights = "© 2020 tazjin";
     authors = [ "tazjin" ];