commit 8f1142f7314881c056e11995f9c6f5363c243108
parent 69c31d72bcb621cfc7090e985dbc39af8dffdf1c
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 15 Sep 2026 21:42:08 +0100
per-topic RSS feeds
Diffstat:
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/main.fnl b/main.fnl
@@ -31,6 +31,10 @@
#(if (= $2 "/") [ :home { :limit 5 } ])
#(if (= $2 "/refresh") [ :refresh {} ])
#(if (= $2 "/news.rss") [ :rss { :limit 10 } ])
+ #(case (string.match $2 "^/topic/([%w_-]+)/news.rss")
+ topic
+ [ :rss {:limit 10 :topic topic } ]
+ )
#(case (string.match $2 "^/(%d+)/(%d+)/")
(year month)
[ :month { :year (tonumber year) :month (tonumber month) } ]
@@ -358,14 +362,14 @@ href=\"https://axillae.telent.net/\">@dan@axillae.telent.net</a>
(page-footer stream)
(stream:write_chunk "" true)))
-(fn send-rss [stream collection]
+(fn send-rss [stream collection limit topic]
(let [posts
(collection:search
{
- :filter nil
+ :filter (and topic { : topic })
:order {:date :descending}
:offset 0
- :limit 5
+ :limit limit
})]
(server.headers stream
{ :content-type "application/rss+xml; charset=utf-8" })
@@ -398,8 +402,10 @@ href=\"https://axillae.telent.net/\">@dan@axillae.telent.net</a>
(case (collection:get slug)
post (send-post-page stream collection post)
nil (server.headers stream { ":status" :404 } true))
- [:rss]
- (send-rss stream collection)
+ [:rss { : limit : topic }]
+ (send-rss stream collection limit topic)
+ [:rss { : limit }]
+ (send-rss stream collection limit nil)
[:refresh _]
(do
(print "refreshing")