about summary refs log tree commit diff
path: root/users/tazjin/homepage/feed.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/homepage/feed.nix')
-rw-r--r--users/tazjin/homepage/feed.nix29
1 files changed, 8 insertions, 21 deletions
diff --git a/users/tazjin/homepage/feed.nix b/users/tazjin/homepage/feed.nix
index 5e1fa15da6..8043d7ff30 100644
--- a/users/tazjin/homepage/feed.nix
+++ b/users/tazjin/homepage/feed.nix
@@ -4,23 +4,10 @@
 with depot.nix.yants;
 
 let
-  inherit (builtins) map readFile sort;
-  inherit (lib) singleton;
+  inherit (builtins) filter map readFile;
+  inherit (lib) max singleton;
   inherit (pkgs) writeText;
-  inherit (depot.users.tazjin) atom-feed blog renderMarkdown;
-
-  postToEntry = defun [ blog.post atom-feed.entry ] (post: rec {
-    id = "https://tazj.in/blog/${post.key}";
-    title = post.title;
-    content = readFile (renderMarkdown post.content);
-    published = post.date;
-    updated = post.date; # TODO(tazjin): this should be distinct from published
-
-    links = singleton {
-      rel = "alternate";
-      href = id;
-    };
-  });
+  inherit (depot.web) blog atom-feed;
 
   pageEntryToEntry = defun [ entry atom-feed.entry ] (e: {
     id = "tazjin:${e.class}:${toString e.date}";
@@ -35,14 +22,13 @@ let
     };
   });
 
-  allEntries = (map postToEntry blog.posts) ++ (map pageEntryToEntry pageEntries);
+  allEntries = (with depot.users.tazjin.blog; map (blog.toFeedEntry config) posts)
+    ++ (map pageEntryToEntry (filter (e: e.class != "note") pageEntries));
 
   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;
     rights = "© 2020 tazjin";
     authors = [ "tazjin" ];
 
@@ -51,6 +37,7 @@ let
       href = "https://tazjin/feed.atom";
     };
 
-    entries = sort (a: b: a.published > b.published) allEntries;
+    entries = allEntries;
   };
-in writeText "feed.atom" (atom-feed.renderFeed feed)
+in
+writeText "feed.atom" (atom-feed.renderFeed feed)