- (p
- "Copyright 2016–2019 Amin Bandali. See "
- ,(aa "license.html" "/license.html") " for license "
- "conditions. Please copy and share."))))))
+ (p "Copyright © "
+ ,(if copy copy "2016–2019")
+ " Amin Bandali. See "
+ ,(if license-page? "the above"
+ (aa "license.html" "/license.html"))
+ " for license conditions. Please copy and share."))))))
+
+(define* (tag-uri prefix tag #:optional (ext ".html"))
+ "Return a URI relative to the site's root for a page listing entries
+in PREFIX that are tagged with TAG."
+ (string-append "/" my-tag-prefix "/" tag ext))
+
+(define* (tag-pages #:key
+ (theme bandali-theme)
+ (prefix "")
+ (filter posts/reverse-chronological))
+ "Return a builder procedure that renders a list page for every tag
+used in a post. All arguments are optional:
+
+PREFIX: The directory in which to write the posts
+FILTER: The procedure called to manipulate the posts list before rendering"
+ (lambda (site posts)
+ (define (tag-list tag posts all-posts)
+ (define (render-list title posts prefix)
+ (let ((body ((theme-collection-template theme)
+ site title posts prefix all-posts tag)))
+ ((theme-layout theme) site title body)))
+ (make-page (tag-uri my-tag-prefix tag)
+ (render-list (string-append "Notes tagged ‘" tag "’")
+ (filter posts)
+ prefix)
+ sxml->html))
+ (let ((tag-groups (posts/group-by-tag posts)))
+ (map (match-lambda
+ ((tag . tagged-posts) (tag-list tag tagged-posts posts)))
+ tag-groups))))