post: Add post-date procedure.
* haunt/post.scm (%default-date): New variable. (post-date): New procedure. * haunt/builder/atom.scm (post->atom-entry): Use post-date. * README.md (Example Configuration): Remove date from default metadata.
This commit is contained in:
parent
3614b3e9b9
commit
3592829387
|
@ -29,10 +29,8 @@ Example Configuration
|
||||||
(site #:title "Built with Guile"
|
(site #:title "Built with Guile"
|
||||||
#:domain "dthompson.us"
|
#:domain "dthompson.us"
|
||||||
#:default-metadata
|
#:default-metadata
|
||||||
`((author . "David Thompson")
|
'((author . "David Thompson")
|
||||||
(email . "davet@gnu.org")
|
(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)))
|
|
||||||
#:readers (list sxml-reader html-reader)
|
#:readers (list sxml-reader html-reader)
|
||||||
#:builders (list (blog)
|
#:builders (list (blog)
|
||||||
(atom-feed)
|
(atom-feed)
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
(name ,(post-ref post 'author))
|
(name ,(post-ref post 'author))
|
||||||
,(let ((email (post-ref post 'email)))
|
,(let ((email (post-ref post 'email)))
|
||||||
(if email `(email ,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"))
|
(link (@ (href ,(string-append "/" (post-slug post) ".html"))
|
||||||
(rel "alternate")))
|
(rel "alternate")))
|
||||||
(summary (@ (type "html"))
|
(summary (@ (type "html"))
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
post-metadata
|
post-metadata
|
||||||
post-ref
|
post-ref
|
||||||
post-slug
|
post-slug
|
||||||
|
%default-date
|
||||||
|
post-date
|
||||||
posts/reverse-chronological
|
posts/reverse-chronological
|
||||||
posts/group-by-tag
|
posts/group-by-tag
|
||||||
|
|
||||||
|
@ -59,6 +61,14 @@
|
||||||
char-set:whitespace))
|
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)
|
(define (post-time post)
|
||||||
(date->time-utc (post-ref post 'date)))
|
(date->time-utc (post-ref post 'date)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue