diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | haunt/builder/atom.scm | 2 | ||||
-rw-r--r-- | haunt/post.scm | 10 |
3 files changed, 13 insertions, 5 deletions
@@ -29,10 +29,8 @@ Example Configuration (site #:title "Built with Guile" #:domain "dthompson.us" #:default-metadata - `((author . "David Thompson") - (email . "davet@gnu.org") - ;; If I'm careless and forget a date, use the UNIX epoch. - (date . ,(make-date 0 0 0 0 1 1 1970 0))) + '((author . "David Thompson") + (email . "davet@gnu.org")) #:readers (list sxml-reader html-reader) #:builders (list (blog) (atom-feed) diff --git a/haunt/builder/atom.scm b/haunt/builder/atom.scm index 337de6d..1cfe1e3 100644 --- a/haunt/builder/atom.scm +++ b/haunt/builder/atom.scm @@ -51,7 +51,7 @@ (name ,(post-ref post 'author)) ,(let ((email (post-ref post 'email))) (if email `(email ,email) '()))) - (updated ,(date->string* (post-ref post 'date))) + (updated ,(date->string* (post-date post))) (link (@ (href ,(string-append "/" (post-slug post) ".html")) (rel "alternate"))) (summary (@ (type "html")) diff --git a/haunt/post.scm b/haunt/post.scm index 08c8872..361fd6d 100644 --- a/haunt/post.scm +++ b/haunt/post.scm @@ -34,6 +34,8 @@ post-metadata post-ref post-slug + %default-date + post-date posts/reverse-chronological posts/group-by-tag @@ -59,6 +61,14 @@ char-set:whitespace)) "-")) +(define %default-date + (make-date 0 0 0 0 1 1 1970 0)) ; UNIX epoch + +(define (post-date post) + "Return the date for POST, or '%default-date' if no date is +specified." + (or (post-ref post 'date) %default-date)) + (define (post-time post) (date->time-utc (post-ref post 'date))) |