From 897c2747b30a6e52434891520467a0d80029a178 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 2 Nov 2019 22:03:09 +0000 Subject: Add the initial implementation of the code --- haunt.scm | 56 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 13 deletions(-) (limited to 'haunt.scm') diff --git a/haunt.scm b/haunt.scm index a945372..3ce7a6a 100644 --- a/haunt.scm +++ b/haunt.scm @@ -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) + (timetime-utc + (post-ref post 'start-date)) + (current-time))) + posts)) + +(define (filter-posts-remove-drafts posts) + (filter (lambda (post) + (timetime-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"))) -- cgit v1.2.3