diff --git a/src/renderer.lisp b/src/renderer.lisp index 13429c8..541fa28 100644 --- a/src/renderer.lisp +++ b/src/renderer.lisp @@ -39,34 +39,23 @@ (script :src "https://cdn.jsdelivr.net/npm/htmx-ext-preload@2.1.1/dist/preload.min.js") (script :src "https://cdn.jsdelivr.net/npm/htmx-ext-head-support@2.0.4/dist/head-support.min.js") (script :src "https://cdn.jsdelivr.net/npm/htmx-ext-response-targets@2.0.3/dist/response-targets.min.js") - (script :src "https://cdn.jsdelivr.net/npm/htmx-ext-alpine-morph@2.0.1/alpine-morph.min.js") - (script :src "https://cdn.jsdelivr.net/npm/@alpinejs/morph@3.14.9/dist/cdn.min.js" :defer t) + ;(script :src "https://cdn.jsdelivr.net/npm/htmx-ext-alpine-morph@2.0.1/alpine-morph.min.js") + ;(script :src "https://cdn.jsdelivr.net/npm/@alpinejs/morph@3.14.9/dist/cdn.min.js" :defer t) (script :src "https://cdn.jsdelivr.net/npm/alpinejs@3.14.9/dist/cdn.min.js" :defer t)) children))) - -(defun set-cache-control (strategy) - (set-response-header :cache-control - (if (string= (website-env) "dev") - "private, no-store" - (cond - ((eq strategy :static) "public, max-age=60, s-maxage=604800, immutable") - ((eq strategy :dynamic) "public, max-age=60") - (t "private, no-store"))))) - (defmethod jingle:process-response ((app jingle:app) result) (set-response-header :content-type "text/html; charset=utf-8") + (set-response-header :cache-control (if (string= (website-env) "dev") + "private, no-store" + "public, max-age=60")) (match result - ((plist :body body - :metadata metadata - :cache cache - :partial partial) - (set-cache-control cache) + ((guard (or (list body metadata) + body) + (typep body 'element)) (call-next-method app (hsx:render-to-string - (if partial - body - (~document :metadata metadata - (~layout - body)))))) + (~document :metadata metadata + (~layout + body))))) (_ (error "Invalid response form")))) diff --git a/src/routes/about.lisp b/src/routes/about.lisp index 6c8f28e..16fc417 100644 --- a/src/routes/about.lisp +++ b/src/routes/about.lisp @@ -19,6 +19,4 @@ (defun handle-get (params) (declare (ignore params)) - (list :body (~page) - :metadata *metadata* - :cache :dynamic)) + (list (~page) *metadata*)) diff --git a/src/routes/blog.lisp b/src/routes/blog.lisp index 9fd252e..0f6b3e7 100644 --- a/src/routes/blog.lisp +++ b/src/routes/blog.lisp @@ -10,10 +10,8 @@ (defcomp ~page () (hsx - (p "coming soon"))) + (p "coming soon"))) (defun handle-get (params) (declare (ignore params)) - (list :body (~page) - :metadata *metadata* - :cache :dynamic)) + (list (~page) *metadata*)) diff --git a/src/routes/index.lisp b/src/routes/index.lisp index 6966243..407a0f8 100644 --- a/src/routes/index.lisp +++ b/src/routes/index.lisp @@ -43,8 +43,7 @@ (defun handle-get (params) (declare (ignore params)) - (list :body (~page) - :cache :static)) + (~page)) ; for health check (defun handle-head (params) diff --git a/src/routes/not-found.lisp b/src/routes/not-found.lisp index 2253893..e71fb4d 100644 --- a/src/routes/not-found.lisp +++ b/src/routes/not-found.lisp @@ -18,6 +18,4 @@ "Back to TOP")))) (defun handle-not-found () - (list :body (~page) - :metadata *metadata* - :cache :dynamic)) + (list (~page) *metadata*)) diff --git a/src/routes/work.lisp b/src/routes/work.lisp index 205c8b3..687f361 100644 --- a/src/routes/work.lisp +++ b/src/routes/work.lisp @@ -15,10 +15,8 @@ (defcomp ~page () (hsx - (p "coming soon"))) + (p "coming soon"))) (defun handle-get (params) (declare (ignore params)) - (list :body (~page) - :metadata *metadata* - :cache :dynamic)) + (list (~page) *metadata*))