diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2015-07-27 21:05:30 +0200 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-07-27 20:30:00 -0400 |
commit | 615361a220747f7376b4e45dd33cd86670284d63 (patch) | |
tree | 779e6f81e0bc057e064a7db5c7454d5a55f247c6 /haunt/builder/atom.scm | |
parent | 228932a48bbae21a0b4ef1add4e2c1bfd9d68691 (diff) |
site: Add site-wide slug procedure setting.
Co-Authored-By: David Thompson <davet@gnu.org>
* haunt/site.scm (<site>)[make-slug]: New field.
(site-make-slug, site-post-slug): New procedures.
(site): Add #:make-slug keyword argument.
* haunt/builder/blog.scm (render-list): Pass site to theme's list
template.
(ugly-theme): Add 'site' argument to #:list-template procedure.
(blog): Use 'site-post-slug'.
* haunt/builder/atom.scm (atom-feed, post->atom-entry): Likewise.
Diffstat (limited to 'haunt/builder/atom.scm')
-rw-r--r-- | haunt/builder/atom.scm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/haunt/builder/atom.scm b/haunt/builder/atom.scm index 12b0df5..339c5ef 100644 --- a/haunt/builder/atom.scm +++ b/haunt/builder/atom.scm @@ -24,6 +24,7 @@ (define-module (haunt builder atom) #:use-module (srfi srfi-19) + #:use-module (srfi srfi-26) #:use-module (ice-9 match) #:use-module (sxml simple) #:use-module (haunt site) @@ -43,7 +44,7 @@ "Convert date to ISO-8601 formatted string." (date->string date "~4")) -(define (post->atom-entry post) +(define (post->atom-entry site post) "Convert POST into an Atom <entry> XML node." `(entry (title ,(post-ref post 'title)) @@ -52,7 +53,7 @@ ,(let ((email (post-ref post 'email))) (if email `(email ,email) '()))) (updated ,(date->string* (post-date post))) - (link (@ (href ,(string-append "/" (post-slug post) ".html")) + (link (@ (href ,(string-append "/" (site-post-slug site post) ".html")) (rel "alternate"))) (summary (@ (type "html")) ,(sxml->html-string (post-sxml post))))) @@ -78,7 +79,7 @@ MAX-ENTRIES: The maximum number of posts to render in the feed" (link (@ (href ,(string-append "/" file-name)) (rel "self"))) (link (@ (href ,(site-domain site)))) - ,@(map post->atom-entry + ,@(map (cut post->atom-entry site <>) (take-up-to max-entries (filter posts)))) sxml->xml*))) |