|
@@ -5,14 +5,6 @@
|
5
|
5
|
(posts :initform nil :initarg :posts :accessor index-posts)
|
6
|
6
|
(title :initform nil :initarg :title :accessor index-title)))
|
7
|
7
|
|
8
|
|
-(defmethod render ((object index) &key prev next)
|
9
|
|
- (funcall (theme-fn 'index) (list :tags (all-tags)
|
10
|
|
- :months (all-months)
|
11
|
|
- :config *config*
|
12
|
|
- :index object
|
13
|
|
- :prev prev
|
14
|
|
- :next next)))
|
15
|
|
-
|
16
|
8
|
(defclass tag-index (index) ())
|
17
|
9
|
(defclass date-index (index) ())
|
18
|
10
|
(defclass int-index (index) ())
|
|
@@ -26,6 +18,14 @@
|
26
|
18
|
(defmethod page-url ((object int-index))
|
27
|
19
|
(format nil "~d" (index-id object)))
|
28
|
20
|
|
|
21
|
+(defmethod render ((object index) &key prev next)
|
|
22
|
+ (funcall (theme-fn 'index) (list :tags (all-tags)
|
|
23
|
+ :months (all-months)
|
|
24
|
+ :config *config*
|
|
25
|
+ :index object
|
|
26
|
+ :prev prev
|
|
27
|
+ :next next)))
|
|
28
|
+
|
29
|
29
|
(defun all-months ()
|
30
|
30
|
"Retrieve a list of all months with published content."
|
31
|
31
|
(let ((months (mapcar (lambda (x) (subseq (content-date x) 0 7))
|
|
@@ -58,20 +58,19 @@
|
58
|
58
|
:posts (subseq content start end)
|
59
|
59
|
:title "Recent Posts")))
|
60
|
60
|
|
|
61
|
+(defun render-index (index &rest render-args)
|
|
62
|
+ "Render the given INDEX using RENDER-ARGS if provided."
|
|
63
|
+ (write-page (page-path index) (apply #'render-page index nil render-args)))
|
|
64
|
+
|
61
|
65
|
(defun render-indices ()
|
62
|
66
|
"Render the indices to view content in groups of size N, by month, and by tag."
|
63
|
67
|
(let ((results (by-date (hash-table-values *content*))))
|
64
|
68
|
(dolist (tag (all-tags))
|
65
|
|
- (let ((index (index-by-tag tag results)))
|
66
|
|
- (write-page (page-path index) (render-page index))))
|
|
69
|
+ (render-index (index-by-tag tag results)))
|
67
|
70
|
(dolist (month (all-months))
|
68
|
|
- (let ((index (index-by-month month results)))
|
69
|
|
- (write-page (page-path index) (render-page index))))
|
|
71
|
+ (render-index (index-by-month month results)))
|
70
|
72
|
(dotimes (i (ceiling (length results) 10))
|
71
|
|
- (let ((index (index-by-n i results)))
|
72
|
|
- (write-page (page-path index)
|
73
|
|
- (render-page index nil
|
74
|
|
- :prev (and (plusp i) i)
|
75
|
|
- :next (and (< (* (1+ i) 10) (length results))
|
76
|
|
- (+ 2 i)))))))
|
77
|
|
- (update-symlink "index.html" "1.html"))
|
|
73
|
+ (render-index (index-by-n i results)
|
|
74
|
+ :prev (and (plusp i) i)
|
|
75
|
+ :next (and (< (* (1+ i) 10) (length results))
|
|
76
|
+ (+ 2 i))))))
|