Simplify metadata
This commit is contained in:
parent
955124f0e0
commit
48dedc92ca
1 changed files with 39 additions and 40 deletions
|
@ -12,6 +12,14 @@
|
||||||
(website-url)
|
(website-url)
|
||||||
(and (not (string= path "/")) path)))
|
(and (not (string= path "/")) path)))
|
||||||
|
|
||||||
|
(defun complete-metadata (metadata)
|
||||||
|
(loop
|
||||||
|
:for (key template) :on *default-metadata* :by #'cddr
|
||||||
|
:for value := (getf metadata key)
|
||||||
|
:append (list key (if (functionp template)
|
||||||
|
(funcall template value)
|
||||||
|
(or value template)))))
|
||||||
|
|
||||||
(defparameter *default-metadata*
|
(defparameter *default-metadata*
|
||||||
(list :title (lambda (title) (format nil "~@[~a - ~]skyizwhite" title))
|
(list :title (lambda (title) (format nil "~@[~a - ~]skyizwhite" title))
|
||||||
:description "The personal website of Akira Tempaku (paku)"
|
:description "The personal website of Akira Tempaku (paku)"
|
||||||
|
@ -22,12 +30,14 @@
|
||||||
:width 1024)
|
:width 1024)
|
||||||
:error nil))
|
:error nil))
|
||||||
|
|
||||||
(defun create-metadata (&key title
|
(defcomp ~metadata (&key metadata)
|
||||||
|
(destructuring-bind (&key title
|
||||||
description
|
description
|
||||||
canonical
|
canonical
|
||||||
type
|
type
|
||||||
image
|
image
|
||||||
error)
|
error)
|
||||||
|
(complete-metadata metadata)
|
||||||
(let ((path (request-uri *request*)))
|
(let ((path (request-uri *request*)))
|
||||||
(hsx
|
(hsx
|
||||||
(<>
|
(<>
|
||||||
|
@ -51,15 +61,4 @@
|
||||||
(link :rel "shortcut icon" :href "/img/favicon.ico")
|
(link :rel "shortcut icon" :href "/img/favicon.ico")
|
||||||
(link :rel "apple-touch-icon" :sizes "180x180" :href "/img/apple-touch-icon.png")
|
(link :rel "apple-touch-icon" :sizes "180x180" :href "/img/apple-touch-icon.png")
|
||||||
(meta :name "apple-mobile-web-app-title" :content "skyizwhite")
|
(meta :name "apple-mobile-web-app-title" :content "skyizwhite")
|
||||||
(link :rel "manifest" :href "/img/site.webmanifest")))))
|
(link :rel "manifest" :href "/img/site.webmanifest"))))))
|
||||||
|
|
||||||
(defun complete-metadata (metadata)
|
|
||||||
(loop
|
|
||||||
:for (key template) :on *default-metadata* :by #'cddr
|
|
||||||
:for value := (getf metadata key)
|
|
||||||
:append (list key (if (functionp template)
|
|
||||||
(funcall template value)
|
|
||||||
(or value template)))))
|
|
||||||
|
|
||||||
(defcomp ~metadata (&key metadata)
|
|
||||||
(apply #'create-metadata (complete-metadata metadata)))
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue