summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Andy Wingo2008-03-02 16:49:11 +0100
committerGravatar Andy Wingo2008-03-02 16:49:11 +0100
commit1ec5fb27ebfc50a7e0c6cd181cd6d8d93b225368 (patch)
tree7942fd3b5f17b510f15be21fe32c65e88bf29814
parentc08973ca92631f38968c33bd8a2017269ecc843e (diff)
downloadtekuti-1ec5fb27ebfc50a7e0c6cd181cd6d8d93b225368.tar.gz
tekuti-1ec5fb27ebfc50a7e0c6cd181cd6d8d93b225368.zip
implement tags/foo
* tekuti/page.scm (page-show-tag): Implement, in a basic way.
-rw-r--r--tekuti/page.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/tekuti/page.scm b/tekuti/page.scm
index 394ed30..318759a 100644
--- a/tekuti/page.scm
+++ b/tekuti/page.scm
@@ -210,7 +210,20 @@
(not-implemented request index))
(define (page-show-tag request index tag)
- (not-implemented request index))
+ (let* ((tags (assq-ref index 'tags))
+ (posts (map (lambda (key)
+ (post-from-key (assq-ref index 'master) key))
+ (hash-ref tags tag '()))))
+ (if (pair? posts)
+ (rcons* request
+ 'title (string-append "posts tagged \"" tag "\"")
+ 'body `((h2 "posts tagged \"" ,tag "\"")
+ ,@(map (lambda (post) `(p ,(post-link post)))
+ posts)))
+ (rcons* request
+ 'status 404
+ 'body `((h2 "Unknown tag " ,tag)
+ (p "No posts were found tagged as \"" ,tag "\"."))))))
(define (page-debug request index)
(rcons* request