diff options
author | 2010-12-24 15:43:47 +0000 | |
---|---|---|
committer | 2011-04-25 19:05:49 +0200 | |
commit | a4bad7a5619a2df7d520742d911fa452fbc25a9c (patch) | |
tree | a8d3b38e9ae6ff8c48a3f53395be112c9baf8e73 | |
parent | efc25df8f43d59310b55317ac8094206a406fe8f (diff) | |
download | tekuti-a4bad7a5619a2df7d520742d911fa452fbc25a9c.tar.gz tekuti-a4bad7a5619a2df7d520742d911fa452fbc25a9c.zip |
add atom feeds for tags
-rw-r--r-- | tekuti/page.scm | 23 | ||||
-rw-r--r-- | tekuti/web.scm | 1 |
2 files changed, 19 insertions, 5 deletions
diff --git a/tekuti/page.scm b/tekuti/page.scm index 6e0b322..f59cae2 100644 --- a/tekuti/page.scm +++ b/tekuti/page.scm @@ -55,6 +55,7 @@ page-debug page-search page-feed-atom + page-feed-atom-tag page-debug page-not-found)) @@ -314,10 +315,10 @@ ,(request-relative-path-str (pk 'not-found request)))) #:status 404)) -(define (page-feed-atom request body index) - (let ((last-modified (let ((posts (published-posts index 1))) - (and (pair? posts) - (post-timestamp (car posts)))))) + +(define (atom-feed-from-posts request body index posts) + (let ((last-modified (and (pair? posts) + (post-timestamp (car posts))))) (cond ((let ((since (request-if-modified-since request))) (and since (>= (date->timestamp since) last-modified))) @@ -334,4 +335,16 @@ (map (lambda (post) (atom-entry post)) - (published-posts index 10)))))))) + posts))))))) + + +(define (page-feed-atom request body index) + (atom-feed-from-posts request body index (published-posts index 10))) + +(define (page-feed-atom-tag request body index tag) + (let* ((tags (assq-ref index 'tags)) + (posts (filter-mapn (lambda (key) + (post-from-key (assq-ref index 'master) key)) + (hash-ref tags tag '()) + 10))) + (atom-feed-from-posts request body index posts))) diff --git a/tekuti/web.scm b/tekuti/web.scm index fcd227d..e1519d7 100644 --- a/tekuti/web.scm +++ b/tekuti/web.scm @@ -54,6 +54,7 @@ ((POST archives year! month! day! post!) page-new-comment) ((GET feed) page-feed-atom) ((GET feed atom) page-feed-atom) + ((GET feed atom tag!) page-feed-atom-tag) ((POST search) page-search) ((GET tags) page-show-tags) ((GET tags tag!) page-show-tag) |