website

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

commit 25a69297e1e8cbad56f18415381b53c6b65c201e
parent 7ff02316f7fa36e2dc91c3438a7a0cce1404e6c4
Author: Adriel Dumas--Jondeau <leirda@disroot.org>
Date:   Thu, 20 Jun 2024 15:44:30 +0200

Ajoute une page spécifique aux évènements sur le lieu

Diffstat:
Mhaunt.scm | 34++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/haunt.scm b/haunt.scm @@ -12,12 +12,16 @@ #:use-module (haunt reader) #:use-module (haunt site) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26)) (define post-prefix "/blog") +(define event-prefix + "/évènements") + (define (post-date->string post) (date->string (post-date post)"~Y-~m-~d")) @@ -46,6 +50,11 @@ `((h1 ,title) (ul ,@(map summary posts)))) +(define (duper-collection-events posts) + (filter (lambda (post) + (member "Évènement" (post-tags post))) + posts)) + (define (duper-layout site title body) `((doctype "html") (head (title ,title)) @@ -69,10 +78,9 @@ (define duper-header `(nav (a (@ (href "/")) ,sxml-logo) - (ul (li (a (@ (href "/articles.html")) - "Articles")) - (li (a (@ (href "/apropos.html")) - "À propos"))))) + ,(urls `(("/blog.html" . "Blog") + ("/évènements.html" . "Évènements") + ("/apropos.html" . "À propos"))))) (define duper-footer `((hr) @@ -91,13 +99,25 @@ #:post-template duper-post-template #:collection-template duper-collection-template)) +(define (posts/filter-by-tags tags) + (lambda (posts) + (filter (lambda (post) + (any (cut member <> tags) + (post-tags post))) + posts))) + (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" "blog.html" ,posts/reverse-chronological) + ("Évènements" "évènements.html" + ,(compose posts/reverse-chronological + (posts/filter-by-tags '("Évènement")))))) + (atom-feed #:subtitle "Blog du duché perché" #:blog-prefix post-prefix) + (atom-feed #:subtitle "Évènements au duché perché" + #:blog-prefix event-prefix) (flat-pages "pages" #:template (theme-layout duper-theme)) (static-directory "css") @@ -122,5 +142,7 @@ #:domain "xn--dech-perch-e7ag.fr" #:readers duper-readers #:builders duper-builders + #:default-metadata + `((author . "les habitante·s du lieu")) #:make-slug make-slug #:publishers duper-publishers)