commit 92956a9211de2469e9e94a5cad8028a34f84901d parent bbec21c1fa7ca6136bffc3962c247168317a2a2a Author: Yuval Langer <yuval.langer@gmail.com> Date: Wed, 3 Jan 2024 16:34:37 +0200 Put last five posts in reverse chronological order, and put the expression in its own let. Diffstat:
M | haunt.scm | | | 33 | +++++++++++++++++---------------- |
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/haunt.scm b/haunt.scm @@ -40,22 +40,23 @@ (define extension-regexp (make-regexp "(\\.\\w+)$")) (define* (make-haunt-blog-index-sxml #:key posts) - `((doctype "html") - (html (head (meta (@ (charset "UTF-8"))) - (link (@ (rel "stylesheet") - (type "text/css") - (href "/assets/index.css"))) - (title "Kaka Farm's Haunt site! D:<")) - (body (h1 "Kakafarm's Haunt") - (p (a (@ (href "/haunt/posts/")) - "posts")) - (p (a (@ (href "/haunt/feed.xml")) - "atom feed")) - (h2 "Latest posts:") - (div (@ (class "latest-posts")) - (ul ,(map post->sxml-link (take posts - (min (length posts) - 5))))))))) + (let ((five-last-posts (take (posts/reverse-chronological posts) + (min (length posts) + 5)))) + `((doctype "html") + (html (head (meta (@ (charset "UTF-8"))) + (link (@ (rel "stylesheet") + (type "text/css") + (href "/assets/index.css"))) + (title "Kaka Farm's Haunt site! D:<")) + (body (h1 "Kakafarm's Haunt") + (p (a (@ (href "/haunt/posts/")) + "posts")) + (p (a (@ (href "/haunt/feed.xml")) + "atom feed")) + (h2 "Latest posts:") + (div (@ (class "latest-posts")) + (ul ,(map post->sxml-link five-last-posts)))))))) (define* (page-builder destination make-sxml) (lambda (site posts)