summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-02 16:08:50 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-02 16:08:50 -0400
commit57f1b4221d4bbb1f1cf4ddf76a9ce959a25b7023 (patch)
tree9afe0ec242f923b319d3a64aa8fd35782181c3ad
parent204be759d3ae0f7256a7e3db8829a1c921470551 (diff)
Implement tag pages
-rw-r--r--haunt.scm21
1 files changed, 18 insertions, 3 deletions
diff --git a/haunt.scm b/haunt.scm
index 5fdfeea..d5bdf1d 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -76,6 +76,22 @@
(define %aliases
'(("blog/post/Bad BEHAVIOR" . "/reverse-engineering-babbys-first-archive-format.html")))
+(define (tag-pages)
+ "Return a procedure that transforms a list of posts into pages containing only
+the posts that have a certain tag."
+ (lambda (site posts)
+ (map (lambda (alist)
+ (let* ((tag-name (car alist))
+ (posts (cdr alist))
+ (title (format #f "Posts tagged as \"~a\"" tag-name))
+ (file-name (format #f "tag-~a.html" tag-name))
+ (body `(h1 ,(format #f "Tagged as \"~a\"" tag-name))))
+ (make-page
+ file-name
+ (render-collection jakob-theme site title posts #f)
+ sxml->html)))
+ (posts/group-by-tag posts))))
+
(site #:title "Jakob's Personal Webpage"
#:domain "jakob.space"
#:default-metadata
@@ -85,10 +101,9 @@
#:builders (list (blog #:theme jakob-theme #:collections %collections)
(article-aliases %aliases)
(atom-feed)
+ (tag-pages)
about-page
projects-page
(static-directory "css")
(static-directory "fonts")
- (static-directory "images")
- (lambda (site posts)
- (map (lambda (alist)
+ (static-directory "images")))