kaka.farm

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

commit aa17c4586ce0e8d594889d90ece67462cb5d42c9
parent 863302dbd2b0d72431b329cb8cd21ab4783bac76
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Tue,  2 Jan 2024 06:25:14 +0200

Define and use a theme.

Diffstat:
Mhaunt.scm | 49++++++++++++++++++++++++++++++++++++-------------
1 file changed, 36 insertions(+), 13 deletions(-)

diff --git a/haunt.scm b/haunt.scm @@ -1,28 +1,32 @@ -(import (ice-9 pretty-print) +(import (srfi srfi-1) + + (ice-9 pretty-print) (ice-9 regex) + (sxml simple) + (haunt artifact) - (haunt asset) (haunt builder assets) (haunt builder atom) (haunt builder blog) - (haunt builder rss) (haunt html) (haunt post) (haunt reader commonmark) - (haunt reader skribe) (haunt reader) - (haunt site) - (haunt kakafarm weechatlog)) + (haunt site)) (define (pp attribute record) (pretty-print (list attribute (attribute record)))) (define (post->sxml-link post) - `(li (a (@ (href ,(regexp-substitute #f - (regexp-exec extension-regexp (post-file-name post)) - 'pre ".html"))) - ,(date->string* (post-date post))))) + `(li (a (@ (href ,(regexp-substitute + #f + (regexp-exec extension-regexp + (post-file-name post)) + 'pre ".html"))) + ,(date->string* (post-date post)) + " - " + ,(cdr (assoc 'title (post-metadata post)))))) (define extension-regexp (make-regexp "(\\.\\w+)$")) @@ -30,7 +34,11 @@ (lambda (site posts) (serialized-artifact destination - `(html (head) + `(html (head (meta (@ (charset "UTF-8"))) + (link (@ (rel "stylesheet") + (type "text/css") + (href "/index.css"))) + (title "Kaka Farm's Haunt site! D:<")) (body (h1 "Kakafarm's Haunt") (p (a (@ (href "/haunt/posts/")) "posts")) @@ -38,16 +46,31 @@ "atom feed")) (h2 "Latest posts:") (div (@ (class "latest-posts")) - (ul ,(map post->sxml-link posts))))) + (ul ,(map post->sxml-link (take posts + (min (length posts) + 5))))))) sxml->html))) +(define (blog-theme-layout a-site a-page-title-string an-sxml-tree) + `(html (head (meta (@ (charset "UTF-8"))) + (link (@ (rel "stylesheet") + (type "text/css") + (href "/index.css"))) + (title "Kaka Farm's Haunt site! D:<")) + (body ,an-sxml-tree))) + +(define blog-theme + (theme #:name "blog-theme" + #:layout blog-theme-layout)) + (site #:title "kaka.farm - Haunt site" #:domain "kaka.farm" #:default-metadata '((author . "Yuval Langer") (email . "yuval.langer@gmail.com")) #:readers (list commonmark-reader sxml-reader) - #:builders (list (blog #:prefix "/haunt/posts") + #:builders (list (blog #:prefix "/haunt/posts" + #:theme blog-theme) (builder-experiment "/haunt/index.html") (atom-feed #:file-name "/haunt/feed.xml" #:blog-prefix "/haunt/posts")