Extract setfs into UPDATE-CONTENT-METADATA.
This commit is contained in:
parent
2268516412
commit
2397b70abb
2 changed files with 7 additions and 2 deletions
|
@ -19,6 +19,7 @@ the last push."
|
|||
"Load all content stored in the blog's repo."
|
||||
(do-subclasses (ctype content)
|
||||
(discover ctype))
|
||||
(update-content-metadata)
|
||||
(do-subclasses (itype index)
|
||||
(discover itype)))
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
(defclass tag-index (index) ())
|
||||
|
||||
(defmethod discover ((doc-type (eql (find-class 'tag-index))))
|
||||
(setf *all-tags* (all-tags))
|
||||
(let ((content (by-date (find-all 'post))))
|
||||
(dolist (tag (all-tags))
|
||||
(add-document (index-by-tag tag content)))))
|
||||
|
@ -43,7 +42,6 @@
|
|||
(defclass month-index (index) ())
|
||||
|
||||
(defmethod discover ((doc-type (eql (find-class 'month-index))))
|
||||
(setf *all-months* (all-months))
|
||||
(let ((content (by-date (find-all 'post))))
|
||||
(dolist (month *all-months*)
|
||||
(add-document (index-by-month month content)))))
|
||||
|
@ -85,6 +83,12 @@
|
|||
|
||||
;;; Helper Functions
|
||||
|
||||
(defun update-content-metadata ()
|
||||
"Set *ALL-TAGS* and *ALL-MONTHS* to the union of all tags and months
|
||||
of content loaded in the DB."
|
||||
(setf *all-tags* (all-tags))
|
||||
(setf *all-months* (all-months)))
|
||||
|
||||
(defun all-months ()
|
||||
"Retrieve a list of all months with published content."
|
||||
(let ((months (mapcar (lambda (x) (subseq (content-date x) 0 7))
|
||||
|
|
Loading…
Add table
Reference in a new issue