summaryrefslogtreecommitdiff
path: root/haunt.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-11-02 22:03:09 +0000
committerChristopher Baines <mail@cbaines.net>2019-11-03 08:26:19 +0000
commit897c2747b30a6e52434891520467a0d80029a178 (patch)
tree025f49d3ec9c6ea60639a172fa30a2a7b897a8a9 /haunt.scm
parenta643f9a12779494ed35813b7906229728cf282e2 (diff)
downloadweekly-news-897c2747b30a6e52434891520467a0d80029a178.tar
weekly-news-897c2747b30a6e52434891520467a0d80029a178.tar.gz
Add the initial implementation of the code
Diffstat (limited to 'haunt.scm')
-rw-r--r--haunt.scm56
1 files changed, 43 insertions, 13 deletions
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)
+ (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")))