From 5d4678d7061c38409ea4ab8f5f3d069d5729ce22 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Thu, 2 May 2019 10:40:37 -0400 Subject: Abstract away the aliases builder --- custom/alias.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'custom/alias.scm') 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))) -- cgit v1.3