|
@@ -27,13 +27,13 @@
|
27
|
27
|
(rel-path (staging *config*) "~d" (index-id object)))
|
28
|
28
|
|
29
|
29
|
(defun all-months ()
|
30
|
|
- "Retrieve a list of all months with published posts."
|
|
30
|
+ "Retrieve a list of all months with published content."
|
31
|
31
|
(sort (remove-duplicates (mapcar (lambda (x) (get-month (content-date x)))
|
32
|
32
|
(hash-table-values *content*)) :test #'string=)
|
33
|
33
|
#'string>))
|
34
|
34
|
|
35
|
35
|
(defun all-tags ()
|
36
|
|
- "Retrieve a list of all tags used in posts."
|
|
36
|
+ "Retrieve a list of all tags used in content."
|
37
|
37
|
(sort (remove-duplicates (mappend 'content-tags (hash-table-values *content*))
|
38
|
38
|
:test #'string=) #'string<))
|
39
|
39
|
|
|
@@ -41,28 +41,28 @@
|
41
|
41
|
"Extract the YYYY-MM portion of TIMESTAMP."
|
42
|
42
|
(subseq timestamp 0 7))
|
43
|
43
|
|
44
|
|
-(defun index-by-tag (tag posts)
|
45
|
|
- "Return an index of all POSTS matching the given TAG."
|
46
|
|
- (let ((content (remove-if-not (lambda (post) (member tag (content-tags post)
|
47
|
|
- :test #'string=)) posts)))
|
|
44
|
+(defun index-by-tag (tag content)
|
|
45
|
+ "Return an index of all CONTENT matching the given TAG."
|
|
46
|
+ (let ((results (remove-if-not (lambda (obj) (member tag (content-tags obj)
|
|
47
|
+ :test #'string=)) content)))
|
48
|
48
|
(make-instance 'tag-index :id tag
|
49
|
|
- :posts content
|
|
49
|
+ :posts results
|
50
|
50
|
:title (format nil "Posts tagged ~a" tag))))
|
51
|
51
|
|
52
|
|
-(defun index-by-month (month posts)
|
53
|
|
- "Return an index of all POSTS matching the given MONTH."
|
54
|
|
- (let ((content (remove-if-not (lambda (post) (search month (content-date post)))
|
55
|
|
- posts)))
|
|
52
|
+(defun index-by-month (month content)
|
|
53
|
+ "Return an index of all CONTENT matching the given MONTH."
|
|
54
|
+ (let ((results (remove-if-not (lambda (obj) (search month (content-date obj)))
|
|
55
|
+ content)))
|
56
|
56
|
(make-instance 'date-index :id month
|
57
|
|
- :posts content
|
|
57
|
+ :posts results
|
58
|
58
|
:title (format nil "Posts from ~a" month))))
|
59
|
59
|
|
60
|
|
-(defun index-by-n (i posts &optional (step 10))
|
61
|
|
- "Return the index for the Ith page of POSTS in reverse chronological order."
|
|
60
|
+(defun index-by-n (i content &optional (step 10))
|
|
61
|
+ "Return the index for the Ith page of CONTENT in reverse chronological order."
|
62
|
62
|
(make-instance 'int-index :id (1+ i)
|
63
|
63
|
:posts (let ((index (* step i)))
|
64
|
|
- (subseq posts index (min (length posts)
|
65
|
|
- (+ index step))))
|
|
64
|
+ (subseq content index (min (length content)
|
|
65
|
+ (+ index step))))
|
66
|
66
|
:title "Recent Posts"))
|
67
|
67
|
|
68
|
68
|
(defun render-indices ()
|