Compare commits
2 commits
5a05f440a8
...
688ef6dc18
Author | SHA1 | Date | |
---|---|---|---|
688ef6dc18 | |||
fd28b11c00 |
7 changed files with 44 additions and 27 deletions
src
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
(defparameter *nav-menu*
|
(defparameter *nav-menu*
|
||||||
'(("/about" "about")
|
'(("/about" "about")
|
||||||
("/work" "work")
|
("/works" "works")
|
||||||
("/blog" "blog")))
|
("/blog" "blog")))
|
||||||
|
|
||||||
(defcomp ~pc-header ()
|
(defcomp ~pc-header ()
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#:microcms-service-domain
|
#:microcms-service-domain
|
||||||
#:microcms-api-key)
|
#:microcms-api-key)
|
||||||
(:export #:get-about
|
(:export #:get-about
|
||||||
#:get-work
|
#:get-works
|
||||||
#:get-blog-list
|
#:get-blog-list
|
||||||
#:get-blog-detail))
|
#:get-blog-detail))
|
||||||
(in-package #:website/lib/cms)
|
(in-package #:website/lib/cms)
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
(define-object-client about)
|
(define-object-client about)
|
||||||
(memorize get-about)
|
(memorize get-about)
|
||||||
|
|
||||||
(define-object-client work)
|
(define-object-client works)
|
||||||
(memorize get-work)
|
(memorize get-works)
|
||||||
|
|
||||||
(define-list-client blog)
|
(define-list-client blog)
|
||||||
(memorize get-blog-list)
|
(memorize get-blog-list)
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
(defmethod jingle:process-response :around ((app jingle:app) result)
|
(defmethod jingle:process-response :around ((app jingle:app) result)
|
||||||
(when (eq (request-method *request*) :get)
|
(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)
|
(cond ((api-request-p)
|
||||||
(set-response-header :content-type "application/json; charset=utf-8")
|
(set-response-header :content-type "application/json; charset=utf-8")
|
||||||
(call-next-method app (to-json result)))
|
(call-next-method app (to-json result)))
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
(defun handle-get (params)
|
(defun handle-get (params)
|
||||||
(setf (context :metadata) *metadata*)
|
(setf (context :metadata) *metadata*)
|
||||||
(with-request-params ((draft-key "draft-key" nil)) params
|
(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))))
|
(let ((about (get-about :query (list :draft-key draft-key))))
|
||||||
(hsx
|
(hsx
|
||||||
(<>
|
(<>
|
||||||
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
(and draft-key (hsx (p :class "text-lg text-pink-500" "下書きモード")))
|
||||||
(article :class "prose max-w-none"
|
(article :class "prose max-w-none"
|
||||||
(h1 "About")
|
(h1 "About")
|
||||||
(div :class "flex justify-center"
|
(div :class "flex justify-center"
|
||||||
(figure :class "flex flex-col items-center"
|
(figure :class "flex flex-col items-center"
|
||||||
(img
|
(img
|
||||||
:src (accesses about :avatar :url)
|
:src (accesses about :avatar :url)
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
(:import-from #:website/helper
|
(:import-from #:website/helper
|
||||||
#:get-request-body-plist)
|
#:get-request-body-plist)
|
||||||
(:import-from #:website/lib/cms
|
(:import-from #:website/lib/cms
|
||||||
#:get-about)
|
#:get-about
|
||||||
|
#:get-works)
|
||||||
(:export #:handle-post))
|
(:export #:handle-post))
|
||||||
(in-package #:website/routes/api/revalidate)
|
(in-package #:website/routes/api/revalidate)
|
||||||
|
|
||||||
|
@ -20,5 +21,6 @@
|
||||||
(return-from handle-post '(:|message| "Invalid token")))
|
(return-from handle-post '(:|message| "Invalid token")))
|
||||||
(let* ((body (get-request-body-plist))
|
(let* ((body (get-request-body-plist))
|
||||||
(api (getf body :|api|)))
|
(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")))
|
'(:|message| "ok")))
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
(defpackage #:website/routes/work
|
|
||||||
(:use #:cl
|
|
||||||
#:hsx
|
|
||||||
#:jingle)
|
|
||||||
(:import-from #:website/lib/cms
|
|
||||||
#:get-work)
|
|
||||||
(:import-from #:website/lib/time
|
|
||||||
#:datetime
|
|
||||||
#:jp-datetime)
|
|
||||||
(:export #:handle-get))
|
|
||||||
(in-package #:website/routes/work)
|
|
||||||
|
|
||||||
(defparameter *metadata*
|
|
||||||
(list :title "work"))
|
|
||||||
|
|
||||||
(defun handle-get (params)
|
|
||||||
(declare (ignore params))
|
|
||||||
(setf (context :metadata) *metadata*)
|
|
||||||
(hsx (p "coming soon")))
|
|
31
src/routes/works.lisp
Normal file
31
src/routes/works.lisp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
(defpackage #:website/routes/works
|
||||||
|
(:use #:cl
|
||||||
|
#:hsx
|
||||||
|
#:jingle)
|
||||||
|
(:import-from #:website/lib/cms
|
||||||
|
#:get-works)
|
||||||
|
(:import-from #:website/lib/time
|
||||||
|
#:datetime
|
||||||
|
#:jp-datetime)
|
||||||
|
(:export #:handle-get))
|
||||||
|
(in-package #:website/routes/works)
|
||||||
|
|
||||||
|
(defparameter *metadata*
|
||||||
|
(list :title "works"))
|
||||||
|
|
||||||
|
(defun handle-get (params)
|
||||||
|
(setf (context :metadata) *metadata*)
|
||||||
|
(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