[hugo/feat] show title and creat (or edit) time

This commit is contained in:
SouthFox 2023-08-29 15:41:17 +08:00
parent f1642f5121
commit 6f7513ce82
2 changed files with 16 additions and 9 deletions

View file

@ -58,7 +58,7 @@
:title (.text title) :title (.text title)
:time (first (str/split (.text post-time) #"・"))}] :time (first (str/split (.text post-time) #"・"))}]
(if hugo (if hugo
(.toString docs) content
{:status 200 {:status 200
:headers {"Content-Type" "application/json; charset=utf-8"} :headers {"Content-Type" "application/json; charset=utf-8"}
:body (wrap-json content)})))) :body (wrap-json content)}))))

View file

@ -5,11 +5,18 @@
(defn build-hu-post (defn build-hu-post
[request] [request]
(let [content (handlers/fetch-hu-post request {:hugo true})]
{:status 200 {:status 200
:headers {"Content-Type" "text/html; charset=utf-8"} :headers {"Content-Type" "text/html; charset=utf-8"}
:body (str (hiccup/html {:escape-strings? false} :body (str
(hiccup/html {:escape-strings? false}
[:html [:html
[:head [:head
[:meta {:name "referrer" :content "no-referrer"}]] [:meta {:name "referrer" :content "no-referrer"}]]
[:body {:style "margin: auto;max-width: 65%;"} [:body {:style "margin: auto;max-width: 65%;"}
(handlers/fetch-hu-post request {:hugo true})]]))}) [:div
[:h1 (:title content)]
[:time (:time content)]
[:hr]]
[:div
(:content content)]]]))}))