Fix feeds and indices.

This commit is contained in:
Brit Butler 2013-01-01 19:41:15 -05:00
parent 6d47244eac
commit 3d1301dc6d
3 changed files with 7 additions and 7 deletions

View file

@ -11,7 +11,7 @@
"Render and write the given FEEDS for the site." "Render and write the given FEEDS for the site."
(flet ((first-10 (list) (flet ((first-10 (list)
(subseq list 0 (min (length list) 10)))) (subseq list 0 (min (length list) 10))))
(let* ((by-date (by-date (hash-table-values *posts*))) (let* ((by-date (by-date (find-all 'post)))
(posts (first-10 by-date)) (posts (first-10 by-date))
(rss (make-instance 'index :id "rss.xml" :posts posts)) (rss (make-instance 'index :id "rss.xml" :posts posts))
(atom (make-instance 'index :id "feed.atom" :posts posts))) (atom (make-instance 'index :id "feed.atom" :posts posts)))

View file

@ -28,7 +28,7 @@
(defun all-months () (defun all-months ()
"Retrieve a list of all months with published posts." "Retrieve a list of all months with published posts."
(sort (remove-duplicates (mapcar (lambda (x) (get-month (post-date x))) (sort (remove-duplicates (mapcar (lambda (x) (get-month (content-date x)))
(hash-table-values *content*)) :test #'string=) (hash-table-values *content*)) :test #'string=)
#'string>)) #'string>))
@ -51,7 +51,7 @@
(defun index-by-month (month posts) (defun index-by-month (month posts)
"Return an index of all POSTS matching the given MONTH." "Return an index of all POSTS matching the given MONTH."
(let ((content (remove-if-not (lambda (post) (search month (post-date post))) (let ((content (remove-if-not (lambda (post) (search month (content-date post)))
posts))) posts)))
(make-instance 'date-index :id month (make-instance 'date-index :id month
:posts content :posts content
@ -67,7 +67,7 @@
(defun render-indices () (defun render-indices ()
"Render the indices to view posts in groups of size N, by month, and by tag." "Render the indices to view posts in groups of size N, by month, and by tag."
(let ((posts (by-date (hash-table-values *content*)))) (let ((posts (by-date (find-all 'post))))
(dolist (tag (all-tags)) (dolist (tag (all-tags))
(let ((index (index-by-tag tag posts))) (let ((index (index-by-tag tag posts)))
(write-page (page-path index) (render-page index)))) (write-page (page-path index) (render-page index))))

View file

@ -14,11 +14,11 @@
(defmethod page-path ((object post)) (defmethod page-path ((object post))
(rel-path (staging *config*) "posts/~a" (content-slug object))) (rel-path (staging *config*) "posts/~a" (content-slug object)))
(defmethod initialize-instance :after ((post post) &key) (defmethod initialize-instance :after ((object post) &key)
(with-accessors ((title post-title) (with-accessors ((title post-title)
(format post-format) (format post-format)
(content post-content)) post (content post-content)) object
(setf (content-slug post) (slugify title) (setf (content-slug object) (slugify title)
format (make-keyword (string-upcase format)) format (make-keyword (string-upcase format))
content (render-content content format)))) content (render-content content format))))