浏览代码

Fix feeds and indices.

Brit Butler 12 年之前
父节点
当前提交
3d1301dc6d
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. 1 1
      src/feeds.lisp
  2. 3 3
      src/indices.lisp
  3. 3 3
      src/posts.lisp

+ 1 - 1
src/feeds.lisp

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

+ 3 - 3
src/indices.lisp

28
 
28
 
29
 (defun all-months ()
29
 (defun all-months ()
30
   "Retrieve a list of all months with published posts."
30
   "Retrieve a list of all months with published posts."
31
-  (sort (remove-duplicates (mapcar (lambda (x) (get-month (post-date x)))
31
+  (sort (remove-duplicates (mapcar (lambda (x) (get-month (content-date x)))
32
                                    (hash-table-values *content*)) :test #'string=)
32
                                    (hash-table-values *content*)) :test #'string=)
33
         #'string>))
33
         #'string>))
34
 
34
 
51
 
51
 
52
 (defun index-by-month (month posts)
52
 (defun index-by-month (month posts)
53
   "Return an index of all POSTS matching the given MONTH."
53
   "Return an index of all POSTS matching the given MONTH."
54
-  (let ((content (remove-if-not (lambda (post) (search month (post-date post)))
54
+  (let ((content (remove-if-not (lambda (post) (search month (content-date post)))
55
                                 posts)))
55
                                 posts)))
56
     (make-instance 'date-index :id month
56
     (make-instance 'date-index :id month
57
                                :posts content
57
                                :posts content
67
 
67
 
68
 (defun render-indices ()
68
 (defun render-indices ()
69
   "Render the indices to view posts in groups of size N, by month, and by tag."
69
   "Render the indices to view posts in groups of size N, by month, and by tag."
70
-  (let ((posts (by-date (hash-table-values *content*))))
70
+  (let ((posts (by-date (find-all 'post))))
71
     (dolist (tag (all-tags))
71
     (dolist (tag (all-tags))
72
       (let ((index (index-by-tag tag posts)))
72
       (let ((index (index-by-tag tag posts)))
73
         (write-page (page-path index) (render-page index))))
73
         (write-page (page-path index) (render-page index))))

+ 3 - 3
src/posts.lisp

14
 (defmethod page-path ((object post))
14
 (defmethod page-path ((object post))
15
   (rel-path (staging *config*) "posts/~a" (content-slug object)))
15
   (rel-path (staging *config*) "posts/~a" (content-slug object)))
16
 
16
 
17
-(defmethod initialize-instance :after ((post post) &key)
17
+(defmethod initialize-instance :after ((object post) &key)
18
   (with-accessors ((title post-title)
18
   (with-accessors ((title post-title)
19
                    (format post-format)
19
                    (format post-format)
20
-                   (content post-content)) post
21
-      (setf (content-slug post) (slugify title)
20
+                   (content post-content)) object
21
+      (setf (content-slug object) (slugify title)
22
             format (make-keyword (string-upcase format))
22
             format (make-keyword (string-upcase format))
23
             content (render-content content format))))
23
             content (render-content content format))))
24
 
24