commit 69a1b7784dbb755ebeacc880c13d1230bc27f5dd
parent 2e2a7db88979a66da66d264d3b17822dcddaf2cf
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 22 Jul 2025 20:32:14 +0100
prettify sidebar
Diffstat:
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/main.fnl b/main.fnl
@@ -112,6 +112,11 @@
(stream:write_chunk
"<footer><div>Powered by <a href=\"https://gti.telent.net/dan/cripslock\">cripslock</a>. Copyright © 2001-2025 Daniel Barlow</div></footer></body></html>"))
+(fn month-name [m]
+ (. ["Jan" "Feb" "Mar" "Apr" "May" "Jun"
+ "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"]
+ m))
+
(fn all-months [site]
(let [h
(accumulate [months {}
@@ -128,24 +133,31 @@
links (fcollect [i 1 12 &into [:li [:b y]]]
(case (. ms i)
m [:span " " [[:a {:href (string.format "/%d/%d/" y m)}]
- m ]]))
+ (month-name m) ]]))
]
links))))
-
+
(fn sidebar [site stream]
(let [s { :write #(stream:write_chunk $2) }
ladder (all-months site)]
- (print (view ladder))
- (stream:write_chunk "<aside><ul>")
+ (stream:write_chunk "<aside>
+<div> <p>
+There are many Daniel Barlows on the internet, but this one's me.
+Computer programmer, inline skater, cyclist, motorcyclist: I can't keep
+it separate and so neither does this blog.
+<p> Shorter, swifter, and less well-formed opinions are also available
+in the Fediverse at <a href=\"https://axillae.telent.net/\">@dan@axillae.telent.net</a>
+<h2>The Archive</h2>
+")
(textile.to-html s (doto ladder (table.insert 1 :ul)))
(stream:write_chunk "</ul></aside>")))
-
+
(define-tests :sidebar
(print (view (all-months post-index))))
-
+
(fn dispatch [route stream]
(let [s { :write #(stream:write_chunk $2) } ]
(case route.command