summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2010-01-15 10:47:46 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2010-01-15 10:47:46 +0100
commit5f168d57beb6171fad96d275fedb6d2a20d5b041 (patch)
tree35e562d215dcab52e0443b494bba2efb7b56ddc8
parent17b39edb2c7daa4ee7f3178c82abba7c2666bc31 (diff)
Generate the individual entries' comment feeds statically.
Ignore-this: b8dd93a01470f45eddc2ad9eae995012 darcs-hash:2d6394dc312b0bb90482b357c48b9589a2b24643
-rwxr-xr-xjournal.lisp24
1 files changed, 21 insertions, 3 deletions
diff --git a/journal.lisp b/journal.lisp
index 26775e6..59a8032 100755
--- a/journal.lisp
+++ b/journal.lisp
@@ -39,7 +39,7 @@
(:index "")
(:full-index "/?full")
(:view-atom-feed (values "/feed"))
- (:view-comment-feed (cond (post-id (values "/comment-feed/~D" post-id))
+ (:view-comment-feed (cond (post-id (values "/~D/comment-feed" post-id))
(t "/comment-feed")))
(:view (cond (comment-id (values "/~D#comment-~D" post-id comment-id))
(post-id (values "/~D" post-id))
@@ -811,6 +811,8 @@
(format t "~&Updating the news feeds...")
(update-atom-feed)
(update-comment-feed)
+ (format t "~&Updating the individual comment feeds...")
+ (update-comment-feeds-for-entries)
(format t "~&Updating the site map...")
(update-site-map))
@@ -830,8 +832,10 @@
(defun update-journal-entry-page (entry)
(with-slots (id title) entry
- (let* ((file-name (format nil "~D.xhtml" id))
- (file-path (merge-pathnames file-name *static-dir*)))
+ (let* ((file-name "index.xhtml")
+ (directory (merge-pathnames (make-pathname :directory (format nil "~D" id)) *static-dir*))
+ (file-path (merge-pathnames file-name directory)))
+ (ensure-directories-exist file-path)
(with-open-file (*standard-output* file-path :direction :output :if-exists :supersede)
(with-yaclml-stream *standard-output*
(let ((*mode* :file))
@@ -850,6 +854,20 @@
(let ((*mode* :file))
(show-comment-feed)))))
+(defun update-comment-feeds-for-entries ()
+ (dotimes (entry-id (+ (find-largest-post-id) 1))
+ (update-comment-feed-for-entry entryid)))
+
+(defun update-comment-feed-for-entry (entry-id)
+ (let* ((file-name "comment-feed.xml")
+ (directory (merge-pathnames (make-pathname :directory (format nil "~D" id)) *static-dir*))
+ (file-path (merge-pathnames file-name directory)))
+ (ensure-directories-exist file-path)
+ (with-open-file (*standard-output* file-path :direction :output :if-exists :supersede)
+ (let ((*mode* :file)
+ (*post-number* entry-id))
+ (show-comment-feed)))))
+
(defun update-site-map ()
(let ((file-path (merge-pathnames "sitemap.xml" *static-dir*)))
(with-open-file (*standard-output* file-path :direction :output :if-exists :supersede)