diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-14 08:50:32 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.org> | 2026-02-14 08:50:32 -0500 |
| commit | 88e2b925af4a9da45f049d65cf7186a1b896996f (patch) | |
| tree | 2646e96453d4794e1a85ab44d7d42240f8bc2401 /jakob/builder/blog.scm | |
| parent | 685e88a7bab401e685210f95fa73598e40dd234b (diff) | |
Create index page
Diffstat (limited to 'jakob/builder/blog.scm')
| -rw-r--r-- | jakob/builder/blog.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/jakob/builder/blog.scm b/jakob/builder/blog.scm index c14cecf..b3f83a6 100644 --- a/jakob/builder/blog.scm +++ b/jakob/builder/blog.scm @@ -33,6 +33,8 @@ #:use-module (srfi srfi-26) #:use-module (web uri) #:export (post-uri + render-preview + sort-posts blog)) ;;; Commentary: @@ -165,6 +167,12 @@ ;; Subdirectory for post listings conditioned on post tags. (define %tag-prefix (string-append %blog-prefix "/tag")) +(define* (sort-posts posts #:keywords (reverse? #f)) + (sort posts (lambda (a b) + ((if reverse? time>=? time<?) + (date->time-monotonic (post-date a)) + (date->time-monotonic (post-date b)))))) + (define (tags->pages posts) "Return a list of pages for each tag used in POSTS, with said pages containing only the posts tagged with that tag." @@ -173,8 +181,8 @@ only the posts tagged with that tag." (items->pages render-preview posts (format #f "Posts tagged with \"~a\"" tag) (tag-uri %tag-prefix tag "")))) - (group-by-tag (sort posts (lambda (a b) - (time<? (date->time-monotonic (post-date a)) (date->time-monotonic (post-date b))))) (cut post-ref <> 'tags)))) + (group-by-tag (sort-posts posts #:reverse? #t) + (cut post-ref <> 'tags)))) (define (all-tags posts) "Return a page summarizing tag usage across POSTS." |