summaryrefslogtreecommitdiff
path: root/haunt/post.scm
diff options
context:
space:
mode:
Diffstat (limited to 'haunt/post.scm')
-rw-r--r--haunt/post.scm20
1 files changed, 18 insertions, 2 deletions
diff --git a/haunt/post.scm b/haunt/post.scm
index ebe2689..d15efd2 100644
--- a/haunt/post.scm
+++ b/haunt/post.scm
@@ -40,6 +40,9 @@
post-slug
%default-date
post-date
+ post-author
+ post-tags
+ post-title
posts/reverse-chronological
posts/group-by-tag
@@ -73,7 +76,7 @@
(or (post-ref post 'slug)
(string-join (map (lambda (s)
(string-filter char-set:slug s))
- (string-split (string-downcase (post-ref post 'title))
+ (string-split (string-downcase (post-title post))
char-set:whitespace))
"-")))
@@ -94,6 +97,19 @@ specified."
(lambda (a b)
(time>? (post-time a) (post-time b)))))
+(define (post-author post)
+ "Return the author of POST, or #f if no author is specified."
+ (post-ref post 'author))
+
+(define (post-tags post)
+ "Return list of tags for POST, or the empty list if no tags are
+specified."
+ (or (post-ref post 'tags) '()))
+
+(define (post-title post)
+ "Return the title of POST, or #f if no title is specified."
+ (post-ref post 'title))
+
(define (posts/group-by-tag posts)
"Return an alist of tags mapped to the posts that used them."
(let ((table (make-hash-table)))
@@ -103,7 +119,7 @@ specified."
(if current
(hash-set! table tag (cons post current))
(hash-set! table tag (list post)))))
- (or (post-ref post 'tags) '())))
+ (post-tags post)))
posts)
(hash-fold alist-cons '() table)))