Indices should work now.
This commit is contained in:
parent
2454656471
commit
67b3f26da3
1 changed files with 26 additions and 19 deletions
|
@ -12,13 +12,21 @@
|
||||||
collect (list :url (format nil "~a/month/~a.html" (domain *config*) month)
|
collect (list :url (format nil "~a/month/~a.html" (domain *config*) month)
|
||||||
:name month))))
|
:name month))))
|
||||||
|
|
||||||
(defun render-index (posts)
|
(defun write-index (posts filename)
|
||||||
(loop for post in posts
|
(let ((content (loop for post in posts
|
||||||
collect (list :url (format nil "~a/posts/~a.html"
|
collect (list :url (format nil "~a/posts/~a.html"
|
||||||
(domain *config*) (post-slug post))
|
(domain *config*) (post-slug post))
|
||||||
:title (post-title post)
|
:title (post-title post)
|
||||||
:date (post-date post)
|
:date (post-date post)
|
||||||
:contents (post-contents post))))
|
:contents (post-contents post)))))
|
||||||
|
(render-page filename
|
||||||
|
(funcall (theme-fn "INDEX")
|
||||||
|
(list :taglinks (taglinks)
|
||||||
|
:monthlinks (monthlinks)
|
||||||
|
:posts content
|
||||||
|
; TODO: Populate prev and next with links.
|
||||||
|
:prev nil
|
||||||
|
:next nil)))))
|
||||||
|
|
||||||
(defun render-by-20 ()
|
(defun render-by-20 ()
|
||||||
(flet ((by-20 (posts start)
|
(flet ((by-20 (posts start)
|
||||||
|
@ -27,14 +35,7 @@
|
||||||
(let ((posts (sort *posts* #'string> :key #'post-date)))
|
(let ((posts (sort *posts* #'string> :key #'post-date)))
|
||||||
(loop for i from 1 then (1+ i)
|
(loop for i from 1 then (1+ i)
|
||||||
until (> (* (1- i) 20) (length posts))
|
until (> (* (1- i) 20) (length posts))
|
||||||
do (render-page (format nil "~d.html" i)
|
do (write-index (by-20 posts i) (format nil "~d.html" i))))))
|
||||||
(funcall (theme-fn "INDEX")
|
|
||||||
(list :taglinks (taglinks)
|
|
||||||
:monthlinks (monthlinks)
|
|
||||||
:posts (render-index (by-20 posts i))
|
|
||||||
; TODO: Populate prev and next with links.
|
|
||||||
:prev nil
|
|
||||||
:next nil)))))))
|
|
||||||
|
|
||||||
(defun render-by-tag ()
|
(defun render-by-tag ()
|
||||||
(let ((tags (remove-duplicates (mapcan #'post-tags *posts*) :test #'string=)))
|
(let ((tags (remove-duplicates (mapcan #'post-tags *posts*) :test #'string=)))
|
||||||
|
@ -43,11 +44,17 @@
|
||||||
(member tag x :test #'string=
|
(member tag x :test #'string=
|
||||||
:key #'post-tags))
|
:key #'post-tags))
|
||||||
posts)))
|
posts)))
|
||||||
(render-index posts)))))
|
(write-index posts (format nil "tag/~a.html" tag))))))
|
||||||
|
|
||||||
(defun render-by-month ())
|
(defun render-by-month ()
|
||||||
|
;; TODO: Make this actually work. Add to render-indices.
|
||||||
|
(let ((months (remove-duplicates (mapcar #'post-date *posts*) :test #'string=)))
|
||||||
|
(loop for month in months
|
||||||
|
do (let ((posts (remove-if-not (lambda (x)
|
||||||
|
(from-month month x)
|
||||||
|
posts))))
|
||||||
|
(render-index posts)))))
|
||||||
|
|
||||||
(defun render-indices ()
|
(defun render-indices ()
|
||||||
(render-by-20)
|
(render-by-20)
|
||||||
(render-by-tag)
|
(render-by-tag))
|
||||||
(render-by-month))
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue