cripslock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 0db3868b126a157f3554db5753800939427593af
parent d1f43a88b1dfe545e705f5add16cfd81367439fa
Author: Daniel Barlow <dan@telent.net>
Date:   Wed, 30 Jul 2025 22:29:07 +0100

next/prev links on month pages

Diffstat:
Mmain.fnl | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/main.fnl b/main.fnl @@ -122,6 +122,9 @@ ] links)))) +(fn cq-stream [stream] + { :write #(stream:write_chunk $2) }) + (fn sidebar [site stream] (let [s { :write #(stream:write_chunk $2) } topics (site:topics) @@ -211,14 +214,32 @@ in the Fediverse at <a href=\"https://axillae.telent.net/\">@dan@axillae.telent. (let [h1 (string.format "%s %d" (month-name month) year) after (os.time {: year : month :day -2 }) before (os.time {: year :month (+ month 1) :day 2 }) + (prevmonth nextmonth) + (case month + 1 (values { :m 12 :y (- year 1) } { :m 2 :y year }) + 12 (values { :m 11 :y year } { :m 1 :y (+ year 1) }) + n (values { :m (- n 1) :y year } { :m (+ n 1) :y year })) + link #(string.format "/%d/%d/" $1.y $1.m) params { :filter {:older before :newer after} :order {:date :ascending} :offset 0 } - posts (post-index:search params)] + posts (post-index:search params) + s (cq-stream stream)] (page-header stream h1) (send-search-results stream :posts posts) + (to-html + [[:div {:class "nav"}] + [:span + [[:a {:href (link prevmonth)}] + "⟪ " (month-name prevmonth.m) " " prevmonth.y]] + " " + [:span + [[:a {:href (link nextmonth)}] + (month-name nextmonth.m) " " nextmonth.y " ⟫"]]] + s) + (sidebar post-index stream) (page-footer stream) (stream:write_chunk "" true )))