diff options
Diffstat (limited to 'haunt.scm')
-rw-r--r-- | haunt.scm | 56 |
1 files changed, 43 insertions, 13 deletions
@@ -1,17 +1,47 @@ -(use-modules (haunt asset) +(use-modules (srfi srfi-1) + (srfi srfi-19) + (haunt asset) (haunt builder blog) (haunt builder atom) (haunt builder assets) - (haunt reader commonmark) - (haunt site)) + (haunt site) + (haunt post) + (src reader) + (src theme)) -(site #:title "Built with Guile" - #:domain "example.com" - #:default-metadata - '((author . "Eva Luator") - (email . "eva@example.com")) - #:readers (list commonmark-reader) - #:builders (list (blog) - (atom-feed) - (atom-feeds-by-tag) - (static-directory "images"))) +;; Set the timezone to UTC, otherwise the dates can get confused. +(setenv "TZ" "utc") + +(define (filter-posts-remove-future-drafts posts) + (filter (lambda (post) + (time<? (date->time-utc + (post-ref post 'start-date)) + (current-time))) + posts)) + +(define (filter-posts-remove-drafts posts) + (filter (lambda (post) + (time<? (date->time-utc + (post-ref post 'end-date)) + (current-time))) + posts)) + +(site #:title "Guix Weekly News" + #:domain "prototype-guix-weekly-news.cbaines.net" + #:readers (list post-reader) + #:builders + (list + (blog #:theme weekly-news-theme + #:collections + `(("Recent posts" "index.html" + ,(compose (lambda (posts) + (take posts 8)) + filter-posts-remove-future-drafts + posts/reverse-chronological)) + ("All posts" "all.html" + ,(compose filter-posts-remove-drafts + posts/reverse-chronological)))) + (atom-feed #:filter + (compose filter-posts-remove-drafts + posts/reverse-chronological)) + (static-directory "static"))) |