Add contents to works page
This commit is contained in:
parent
fd28b11c00
commit
688ef6dc18
4 changed files with 23 additions and 6 deletions
src
|
@ -16,7 +16,9 @@
|
|||
|
||||
(defmethod jingle:process-response :around ((app jingle:app) result)
|
||||
(when (eq (request-method *request*) :get)
|
||||
(set-response-header :cache-control "public, max-age=60"))
|
||||
(if (context :no-cache)
|
||||
(set-response-header :cache-control "private, no-store, must-revalidate")
|
||||
(set-response-header :cache-control "public, max-age=60")))
|
||||
(cond ((api-request-p)
|
||||
(set-response-header :content-type "application/json; charset=utf-8")
|
||||
(call-next-method app (to-json result)))
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
(defun handle-get (params)
|
||||
(setf (context :metadata) *metadata*)
|
||||
(with-request-params ((draft-key "draft-key" nil)) params
|
||||
(setf (context :no-cache) draft-key)
|
||||
(let ((about (get-about :query (list :draft-key draft-key))))
|
||||
(hsx
|
||||
(<>
|
||||
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
||||
(article :class "prose max-w-none"
|
||||
(h1 "About")
|
||||
(div :class "flex justify-center"
|
||||
(div :class "flex justify-center"
|
||||
(figure :class "flex flex-col items-center"
|
||||
(img
|
||||
:src (accesses about :avatar :url)
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
(:import-from #:website/helper
|
||||
#:get-request-body-plist)
|
||||
(:import-from #:website/lib/cms
|
||||
#:get-about)
|
||||
#:get-about
|
||||
#:get-works)
|
||||
(:export #:handle-post))
|
||||
(in-package #:website/routes/api/revalidate)
|
||||
|
||||
|
@ -20,5 +21,6 @@
|
|||
(return-from handle-post '(:|message| "Invalid token")))
|
||||
(let* ((body (get-request-body-plist))
|
||||
(api (getf body :|api|)))
|
||||
(cond ((string= api "about") (clear-cache 'get-about)))
|
||||
(cond ((string= api "about") (clear-cache 'get-about))
|
||||
((string= api "works") (clear-cache 'get-works)))
|
||||
'(:|message| "ok")))
|
||||
|
|
|
@ -14,6 +14,18 @@
|
|||
(list :title "works"))
|
||||
|
||||
(defun handle-get (params)
|
||||
(declare (ignore params))
|
||||
(setf (context :metadata) *metadata*)
|
||||
(hsx (p "coming soon")))
|
||||
(with-request-params ((draft-key "draft-key" nil)) params
|
||||
(setf (context :no-cache) draft-key)
|
||||
(let ((works (get-works :query (list :draft-key draft-key))))
|
||||
(hsx
|
||||
(<>
|
||||
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
||||
(article :class "prose max-w-none"
|
||||
(h1 "Works")
|
||||
(raw! (getf works :content))
|
||||
(p :class "text-right"
|
||||
"(最終更新:"
|
||||
(|time| :datetime (datetime (getf works :revised-at))
|
||||
(jp-datetime (getf works :revised-at)))
|
||||
")")))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue