kaka.farm

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

commit be51ff19bf4b3d21b458e8acdb9d45ab31199c3f
parent 4a2c05f57a81b04ea3f50ceebae9c4ea59b8e702
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri, 22 Dec 2023 04:46:35 +0200

Fix the latest posts link.

Diffstat:
Mhaunt.scm | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/haunt.scm b/haunt.scm @@ -1,4 +1,5 @@ (import (ice-9 pretty-print) + (ice-9 regex) (sxml simple) (haunt artifact) (haunt asset) @@ -18,22 +19,26 @@ (pretty-print (list attribute (attribute record)))) (define (post->sxml-link post) - `(li (a (@ (href ,(post-file-name post))) + `(li (a (@ (href ,(regexp-substitute #f + (regexp-exec extension-regexp (post-file-name post)) + 'pre ".html"))) ,(date->string* (post-date post))))) +(define extension-regexp (make-regexp "(\\.\\w+)$")) + (define* (builder-experiment destination) (lambda (site posts) (serialized-artifact destination `(html (head) (body (h1 "Kakafarm's Haunt") - (h2 "Latest posts:") - (div (@ (class "latest-posts")) - (ul ,(map post->sxml-link posts))) (p (a (@ (href "/haunt/posts/")) "posts")) (p (a (@ (href "/haunt/feed.xml")) - "atom feed")))) + "atom feed")) + (h2 "Latest posts:") + (div (@ (class "latest-posts")) + (ul ,(map post->sxml-link posts))))) sxml->html))) (site #:title "kaka.farm - Haunt site"