From 75852568eac90bf0c63a7d8371a68273e83be992 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 23 Oct 2019 11:40:09 -0400 Subject: [PATCH] Refine RSS feed --- src/blog/feed.xml.pp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/blog/feed.xml.pp b/src/blog/feed.xml.pp index 95521ea..d540ce2 100644 --- a/src/blog/feed.xml.pp +++ b/src/blog/feed.xml.pp @@ -1,7 +1,9 @@ #lang pollen -◊(require pollen/core +◊(require gregor + pollen/core pollen/pagetree pollen/file + pollen/template racket/path racket/string) @@ -14,18 +16,32 @@ ◊(current-pagetree ptree) +◊(define (rfc822 dt) (~t dt "E, dd MMM yyyy HH:mm:ss Z")) + ◊(define (render-item item) - (let ((src (get-source (path->string (path->complete-path (symbol->string item)))))) + (let* ((src (get-source (path->string (path->complete-path (symbol->string item))))) + (link (format "https://jeremydormitzer.com/blog/~a" item))) (format " ~a ~a + ~a + ~a + ~a " (select 'h1 src) - (format "https://jeremydormitzer.com/blog/~a" item)))) + link + link + (->html (get-doc src)) + (rfc822 (with-timezone + (at-midnight + (parse-date (select-from-metas 'published src) "yyyy-MM-dd")) + "America/New_York"))))) ◊(define (render-items items) (string-join (map render-item items) "\n")) + +◊(define today (rfc822 (now/moment))) @@ -35,6 +51,8 @@ en-us © Jeremy Dormitzer 2019 60 - ◊(render-items (children 'blog)) + ◊|today| + https://validator.w3.org/feed/docs/rss2.html + ◊(render-items (sort (children 'blog) date>? #:key post-published-date))