haunt.scm (4090B)
1 (define-module (duché-perché website) 2 #:use-module (duper) 3 #:use-module (duper builder gallery) 4 5 #:use-module (haunt asset) 6 #:use-module (haunt builder assets) 7 #:use-module (haunt builder atom) 8 #:use-module (haunt builder blog) 9 #:use-module (haunt builder flat-pages) 10 #:use-module (haunt post) 11 #:use-module (haunt publisher) 12 #:use-module (haunt publisher rsync) 13 #:use-module (haunt reader) 14 #:use-module (haunt site) 15 16 #:use-module (srfi srfi-1) 17 #:use-module (srfi srfi-26)) 18 19 (define post-prefix 20 "/blog") 21 22 (define event-prefix 23 "/évènements") 24 25 (define (duper-post-template post) 26 `((div (@ (class "post-title")) 27 (h1 ,(post-title post)) 28 (p "Par " ,(post-author post) 29 ", le " ,(post-date->string post))) 30 ,(post-sxml post))) 31 32 (define (duper-collection-template site title posts prefix) 33 (define (post-uri post) 34 (string-append (or prefix "") "/" 35 (site-post-slug site post) ".html")) 36 37 (define (summary post) 38 `(li (@ (class "summary")) 39 (a (@ (href ,(post-uri post))) 40 ,(post-title post) 41 " – " ,(post-date->string post)))) 42 43 `((h1 ,title) 44 (ul ,@(map summary posts)))) 45 46 (define (duper-collection-events posts) 47 (filter (lambda (post) 48 (member "Évènement" (post-tags post))) 49 posts)) 50 51 (define (duper-layout site title body) 52 `((doctype "html") 53 (meta (@ (charset "utf-8"))) 54 (meta (@ (name "viewport") 55 (content "width=device-width, initial-scale=1"))) 56 57 (meta (@ (name "description") (content ,title))) 58 (head (title ,title)) 59 60 (link (@ (rel "stylesheet") 61 (href "/css/duper.css"))) 62 (link (@ (rel "icon") 63 (type "image/svg+xml") 64 (href "/assets/logo.svg"))) 65 66 (body (header ,duper-header) 67 (article ,body) 68 (footer ,duper-footer)))) 69 70 (define duper-header 71 `(nav (a (@ (href "/")) 72 ,sxml-logo) 73 ,(urls `(("/blog.html" . "Blog") 74 ("/évènements.html" . "Évènements") 75 ("/photos.html" . "Galerie") 76 ("/apropos.html" . "À propos"))))) 77 78 (define duper-footer 79 `((hr) 80 (p "Fait par Adriel avec ❤ et " (i "Haunt") "." (br) 81 "Le contenu de ce site est disponible sous licence " 82 (i "CC BY-SA.") (br) 83 ,(urls `(("https://git.duché-perché.fr/website.git" 84 . "les sources de ce site") 85 ("https://dthompson.us/projects/haunt.html" 86 . "le projet Haunt") 87 ("https://creativecommons.org/licenses/by-sa/4.0/" 88 . "la licence CC BY-SA")))))) 89 90 (define duper-theme 91 (theme #:name "duper" 92 #:layout duper-layout 93 #:post-template duper-post-template 94 #:collection-template duper-collection-template)) 95 96 (define (posts/filter-by-tags tags) 97 (lambda (posts) 98 (filter (lambda (post) 99 (any (cut member <> tags) 100 (post-tags post))) 101 posts))) 102 103 (define duper-builders 104 (list (blog #:theme duper-theme 105 #:post-prefix post-prefix 106 #:collections 107 `(("Blog" "blog.html" ,posts/reverse-chronological) 108 ("Évènements" "évènements.html" 109 ,(compose posts/reverse-chronological 110 (posts/filter-by-tags '("Évènement")))))) 111 (atom-feed #:subtitle "Blog du duché perché" 112 #:blog-prefix post-prefix) 113 (atom-feed #:subtitle "Évènements au duché perché" 114 #:blog-prefix event-prefix) 115 (gallery #:file-name "/photos.html" 116 #:section-template duper-gallery-template 117 #:template (theme-layout duper-theme)) 118 (flat-pages "pages" 119 #:template (theme-layout duper-theme)) 120 (static-directory "css") 121 (static-directory "assets"))) 122 123 (define duper-readers 124 (list sxml-reader)) 125 126 (define duper-publishers 127 (list (rsync-publisher 128 #:destination "/srv/duché-perché.fr" 129 #:user "root" 130 #:host "xn--duch-perch-e7ag.fr" 131 #:flags (list "--rsh=ssh -i angine" 132 "--rsync-path=/usr/bin/rsync" 133 "--compress" 134 "--checksum" 135 "--delete" 136 "--progress" 137 "--recursive")))) 138 139 (site #:title "Le Duché Perché" 140 #:domain "xn--duch-perch-e7ag.fr" 141 #:readers duper-readers 142 #:builders duper-builders 143 #:default-metadata 144 `((author . "tous les membres du duché perché")) 145 #:make-slug make-slug 146 #:publishers duper-publishers)