Remove metadata component
This commit is contained in:
parent
0ad8c14e10
commit
f1c711ea43
6 changed files with 30 additions and 42 deletions
src
|
@ -18,8 +18,8 @@
|
||||||
(defmethod jg:not-found ((app jg:app))
|
(defmethod jg:not-found ((app jg:app))
|
||||||
(view:render (cmp:not-found-page)
|
(view:render (cmp:not-found-page)
|
||||||
:status :not-found
|
:status :not-found
|
||||||
:title "404 Not Found"
|
:metadata '(:title "404 Not Found"
|
||||||
:description "お探しのページは見つかりませんでした。"))
|
:description "お探しのページは見つかりませんでした。")))
|
||||||
|
|
||||||
(defun start ()
|
(defun start ()
|
||||||
(jg:start *app*))
|
(jg:start *app*))
|
||||||
|
|
|
@ -4,9 +4,23 @@
|
||||||
(:export #:document))
|
(:export #:document))
|
||||||
(in-package #:hp/components/global/document)
|
(in-package #:hp/components/global/document)
|
||||||
|
|
||||||
(pi:define-element document (metadata)
|
(pi:define-element document (title description)
|
||||||
(pi:h
|
(pi:h
|
||||||
(html :lang "ja"
|
(html :lang "ja"
|
||||||
metadata
|
(head
|
||||||
(body :hx-ext "head-support"
|
(meta :charset "UTF-8")
|
||||||
pi:children))))
|
(script :src "/scripts/htmx.js")
|
||||||
|
(script :src "/scripts/htmx-ext/head-support.js")
|
||||||
|
(script :src "/scripts/alpine.js" :defer t)
|
||||||
|
(link :rel "stylesheet" :type "text/css" :href "/styles/ress.css")
|
||||||
|
(link :rel "stylesheet" :type "text/css" :href "/styles/global.css")
|
||||||
|
(link :rel "preconnect" :href "https://fonts.googleapis.com")
|
||||||
|
(link :rel "preconnect" :href "https://fonts.gstatic.com" :crossorigin t)
|
||||||
|
(link
|
||||||
|
:rel "stylesheet"
|
||||||
|
:href "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap")
|
||||||
|
(title (format nil "~@[~a - ~]skyizwhite.dev" title))
|
||||||
|
(meta
|
||||||
|
:name "description"
|
||||||
|
:content (or description "pakuの個人サイト")))
|
||||||
|
pi:children)))
|
||||||
|
|
|
@ -6,4 +6,5 @@
|
||||||
|
|
||||||
(pi:define-element layout ()
|
(pi:define-element layout ()
|
||||||
(pi:h
|
(pi:h
|
||||||
(main pi:children)))
|
(body :hx-ext "head-support"
|
||||||
|
(main pi:children))))
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
(defpackage #:hp/components/global/metadata
|
|
||||||
(:use #:cl)
|
|
||||||
(:local-nicknames (#:pi #:piccolo))
|
|
||||||
(:export #:metadata))
|
|
||||||
(in-package #:hp/components/global/metadata)
|
|
||||||
|
|
||||||
(pi:define-element metadata (title description)
|
|
||||||
(pi:h
|
|
||||||
(head
|
|
||||||
(meta :charset "UTF-8")
|
|
||||||
(script :src "/scripts/htmx.js")
|
|
||||||
(script :src "/scripts/htmx-ext/head-support.js")
|
|
||||||
(script :src "/scripts/alpine.js" :defer t)
|
|
||||||
(link :rel "stylesheet" :type "text/css" :href "/styles/ress.css")
|
|
||||||
(link :rel "stylesheet" :type "text/css" :href "/styles/global.css")
|
|
||||||
(link :rel "preconnect" :href "https://fonts.googleapis.com")
|
|
||||||
(link :rel "preconnect" :href "https://fonts.gstatic.com" :crossorigin t)
|
|
||||||
(link
|
|
||||||
:rel "stylesheet"
|
|
||||||
:href "https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap")
|
|
||||||
(title (format nil "~@[~a - ~]skyizwhite.dev" title))
|
|
||||||
(meta
|
|
||||||
:name "description"
|
|
||||||
:content (or description "pakuの個人サイト")))))
|
|
|
@ -5,6 +5,10 @@
|
||||||
(:export #:on-get))
|
(:export #:on-get))
|
||||||
(in-package #:hp/routes/about)
|
(in-package #:hp/routes/about)
|
||||||
|
|
||||||
|
(defparameter *metadata*
|
||||||
|
'(:title "about"
|
||||||
|
:description "pakuの自己紹介"))
|
||||||
|
|
||||||
(pi:define-element page ()
|
(pi:define-element page ()
|
||||||
(pi:h
|
(pi:h
|
||||||
(section
|
(section
|
||||||
|
@ -12,6 +16,4 @@
|
||||||
|
|
||||||
(defun on-get (params)
|
(defun on-get (params)
|
||||||
(declare (ignore params))
|
(declare (ignore params))
|
||||||
(view:render (page)
|
(view:render (page) :metadata *metadata*))
|
||||||
:title "about"
|
|
||||||
:description "pakuの自己紹介"))
|
|
||||||
|
|
|
@ -6,14 +6,9 @@
|
||||||
(:export #:render))
|
(:export #:render))
|
||||||
(in-package #:hp/view)
|
(in-package #:hp/view)
|
||||||
|
|
||||||
(defun render (page &key status title description)
|
(defun render (page &key metadata status)
|
||||||
(jg:with-html-response
|
(jg:with-html-response
|
||||||
(and status (jg:set-response-status status))
|
(and status (jg:set-response-status status))
|
||||||
(pi:elem-str
|
(pi:elem-str
|
||||||
(let ((md (cmp:metadata :title title :description description))
|
(cmp:document metadata
|
||||||
(body (cmp:layout page)))
|
(cmp:layout page)))))
|
||||||
(pi:h
|
|
||||||
(if (jg:get-request-header "HX-Boosted")
|
|
||||||
(<> md body)
|
|
||||||
(cmp:document :metadata md
|
|
||||||
body)))))))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue