summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-02 10:40:37 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-02 10:49:11 -0400
commit5d4678d7061c38409ea4ab8f5f3d069d5729ce22 (patch)
tree58208098f925a3d63c7268fc10c2b4338cafac8a
parentf9e38be6c95594e9642e2530e2aa0286cff5a00f (diff)
Abstract away the aliases builder
-rw-r--r--custom/alias.scm12
-rw-r--r--haunt.scm7
2 files changed, 12 insertions, 7 deletions
diff --git a/custom/alias.scm b/custom/alias.scm
index fde03c7..6bc5062 100644
--- a/custom/alias.scm
+++ b/custom/alias.scm
@@ -17,7 +17,7 @@
(define-module (custom alias)
#:use-module (haunt html)
#:use-module (haunt page)
- #:export (article-alias))
+ #:export (article-aliases))
(define (article-alias alias target)
"Create a page named ALIAS that redirects to TARGET."
@@ -32,3 +32,13 @@
(meta (@ (http-equiv "refresh")
(content ,(string-append "0; " target)))))))
sxml->html))
+
+(define (article-aliases aliases)
+ "Return a procedure that transforms a list of article ALIASES into pages
+redirecting from one arbitrary file to another."
+ (lambda (site posts)
+ (map (lambda (alist)
+ (let ((alias (car alist))
+ (target (cdr alist)))
+ (article-alias alias target)))
+ aliases)))
diff --git a/haunt.scm b/haunt.scm
index 77c56af..75dfd24 100644
--- a/haunt.scm
+++ b/haunt.scm
@@ -194,8 +194,8 @@ free culture works available under the " ,%cc-by-sa-link " license.")
(email . "zerodaysfordays@sdf.lonestar.org"))
#:readers (list html-reader-prime)
#:builders (list (blog #:theme jakob-theme #:collections %collections)
+ (article-aliases %aliases)
(atom-feed)
- (atom-feeds-by-tag)
about-page
projects-page
(static-directory "css")
@@ -203,8 +203,3 @@ free culture works available under the " ,%cc-by-sa-link " license.")
(static-directory "images")
(lambda (site posts)
(map (lambda (alist)
- (let ((alias (car alist))
- (target (cdr alist)))
- (article-alias alias target)))
- %aliases))))
-