Add blog page
This commit is contained in:
parent
922a249ead
commit
e9f5e66574
8 changed files with 132 additions and 30 deletions
src/routes/blog
37
src/routes/blog/index.lisp
Normal file
37
src/routes/blog/index.lisp
Normal file
|
@ -0,0 +1,37 @@
|
|||
(defpackage #:website/routes/blog/index
|
||||
(:use #:cl
|
||||
#:hsx
|
||||
#:jingle)
|
||||
(:import-from #:website/lib/cms
|
||||
#:get-blog-list)
|
||||
(:import-from #:website/lib/time
|
||||
#:asctime)
|
||||
(:export #:handle-get))
|
||||
(in-package #:website/routes/blog/index)
|
||||
|
||||
(defparameter *metadata*
|
||||
(list :title "blog"))
|
||||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :metadata) *metadata*)
|
||||
(let ((blogs (getf (get-blog-list :query '(:fields "id,title,publishedAt"
|
||||
:limit 100))
|
||||
:contents)))
|
||||
(hsx
|
||||
(section
|
||||
(h1 :class "font-bold text-4xl mb-8"
|
||||
"Blog")
|
||||
(ul :preload "mouseover" :class "flex flex-col gap-y-2"
|
||||
(loop
|
||||
:for item :in blogs :collect
|
||||
(hsx
|
||||
(li :class "marker:m-0"
|
||||
(a
|
||||
:class "hover:text-pink-500"
|
||||
:href (format nil "/blog/~a" (getf item :id))
|
||||
(span "・ " (getf item :title))
|
||||
(span :class "text-sm text-gray-400 ml-2"
|
||||
"(" (asctime (getf item :published-at)) ")"))))))
|
||||
;TODO: pagenation
|
||||
))))
|
Loading…
Add table
Add a link
Reference in a new issue