From 5f168d57beb6171fad96d275fedb6d2a20d5b041 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Fri, 15 Jan 2010 10:47:46 +0100 Subject: Generate the individual entries' comment feeds statically. Ignore-this: b8dd93a01470f45eddc2ad9eae995012 darcs-hash:2d6394dc312b0bb90482b357c48b9589a2b24643 --- journal.lisp | 24 +++++++++++++++++++++--- 1 file 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) -- cgit v1.2.3