website

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

commit 708f01ba2a661de9eda352a260e9f53fbd82f29a
parent 09f62fd5e2492b1bd176cb2f961eeae19160221b
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date:   Fri, 24 May 2024 14:26:59 +0200

Ajoute le fichier de génération du site avec haunt

Diffstat:
Ahaunt.scm | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+), 0 deletions(-)

diff --git a/haunt.scm b/haunt.scm @@ -0,0 +1,88 @@ +(define-module (duché-perché website) + #:use-module (duper) + #:use-module (haunt asset) + #:use-module (haunt builder assets) + #:use-module (haunt builder atom) + #:use-module (haunt builder blog) + #:use-module (haunt builder flat-pages) + #:use-module (haunt post) + #:use-module (haunt publisher) + #:use-module (haunt publisher rsync) + #:use-module (haunt reader) + #:use-module (haunt site) + #:use-module (srfi srfi-19) + #:use-module (srfi srfi-26)) + +(define post-prefix + "/blog") + +(define (post-date->string post) + (date->string (post-date post)"~Y-~m-~d")) + +(define (make-slug post) + (string-append/shared + (post-date->string post) "-" (post-slug-v2 post))) + +(define (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-header + `(nav (a (@ (href "/")) + ,sxml-logo) + (ul (li (a (@ (href "/articles.html")) + "Articles")) + (li (a (@ (href "/apropos.html")) + "À propos"))))) + +(define duper-footer + `()) + +(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)))))) + +(define duper-builders + (list (blog #:theme duper-theme + #:post-prefix post-prefix + #:collections + `(("Articles" "articles.html" ,posts/reverse-chronological))) + (atom-feed #:subtitle "Articles du duché perché" + #:blog-prefix post-prefix) + (flat-pages "pages" + #:template (theme-layout duper-theme)) + (static-directory "css") + (static-directory "assets"))) + +(define duper-readers + (list sxml-reader)) + +(site #:title "Le Duché Perché" + #:domain "xn--dech-perch-e7ag.fr" + #:readers duper-readers + #:builders duper-builders + #:make-slug make-slug)