website

Le code pour générer le site web du duché perché.
Log | Files | Refs

commit 21c841d0f69e1ba0a4cb8b2cc5aa9ca6eeac413a
parent 630ce7d481ac7151c3e9999e81514f5e9b8e6c40
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date:   Fri, 24 May 2024 15:06:15 +0200

Sépare le layout du thème, pour en faciliter la réutilisation

Diffstat:
Mhaunt.scm | 48+++++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/haunt.scm b/haunt.scm @@ -1,5 +1,6 @@ (define-module (duché-perché website) #:use-module (duper) + #:use-module (haunt asset) #:use-module (haunt builder assets) #:use-module (haunt builder atom) @@ -10,6 +11,7 @@ #:use-module (haunt publisher rsync) #:use-module (haunt reader) #:use-module (haunt site) + #:use-module (srfi srfi-19) #:use-module (srfi srfi-26)) @@ -23,13 +25,33 @@ (string-append/shared (post-date->string post) "-" (post-slug-v2 post))) -(define (post-template post) +(define (duper-post-template post) `((div (@ (class "post-title")) (h1 ,(post-title post)) (p "Par " ,(post-author post) ", le " ,(post-date->string post))) ,(post-sxml post))) +(define (duper-layout site title body) + `((doctype "html") + (head (title ,title)) + + (meta (@ (name "description") + (content ,title))) + (meta (@ (charset "utf-8"))) + (meta (@ (name "viewport") + (content "width=device-width, initial-scale=1"))) + + (link (@ (rel "stylesheet") + (href "/css/duper.css"))) + (link (@ (rel "icon") + (type "image/svg+xml") + (href "/assets/logo.svg"))) + + (body (header ,duper-header) + (article ,body) + (footer ,duper-footer)))) + (define duper-header `(nav (a (@ (href "/")) ,sxml-logo) @@ -43,28 +65,8 @@ (define duper-theme (theme #:name "duper" - #:post-template post-template - #:layout - (lambda (site title body) - `((doctype "html") - - (head (title ,title) - - (meta (@ (name "description") - (content ,title))) - (meta (@ (charset "utf-8"))) - (meta (@ (name "viewport") - (content "width=device-width, initial-scale=1"))) - - (link (@ (rel "stylesheet") - (href "/css/duper.css"))) - (link (@ (rel "icon") - (type "image/svg+xml") - (href "/assets/logo.svg")))) - - (body (header ,duper-header) - (article ,body) - (footer ,duper-footer)))))) + #:layout duper-layout + #:post-template duper-post-template)) (define duper-builders (list (blog #:theme duper-theme