From 6f7513ce82e518fc936940938ec1623719b707fe Mon Sep 17 00:00:00 2001 From: SouthFox Date: Tue, 29 Aug 2023 15:41:17 +0800 Subject: [PATCH] [hugo/feat] show title and creat (or edit) time --- src/main/backend/handlers.clj | 2 +- src/main/backend/hugo/site.clj | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/main/backend/handlers.clj b/src/main/backend/handlers.clj index 1bc203e..c540416 100644 --- a/src/main/backend/handlers.clj +++ b/src/main/backend/handlers.clj @@ -58,7 +58,7 @@ :title (.text title) :time (first (str/split (.text post-time) #"・"))}] (if hugo - (.toString docs) + content {:status 200 :headers {"Content-Type" "application/json; charset=utf-8"} :body (wrap-json content)})))) diff --git a/src/main/backend/hugo/site.clj b/src/main/backend/hugo/site.clj index 12dfcf0..067c94a 100644 --- a/src/main/backend/hugo/site.clj +++ b/src/main/backend/hugo/site.clj @@ -5,11 +5,18 @@ (defn build-hu-post [request] - {:status 200 - :headers {"Content-Type" "text/html; charset=utf-8"} - :body (str (hiccup/html {:escape-strings? false} - [:html - [:head - [:meta {:name "referrer" :content "no-referrer"}]] - [:body {:style "margin: auto;max-width: 65%;"} - (handlers/fetch-hu-post request {:hugo true})]]))}) + (let [content (handlers/fetch-hu-post request {:hugo true})] + {:status 200 + :headers {"Content-Type" "text/html; charset=utf-8"} + :body (str + (hiccup/html {:escape-strings? false} + [:html + [:head + [:meta {:name "referrer" :content "no-referrer"}]] + [:body {:style "margin: auto;max-width: 65%;"} + [:div + [:h1 (:title content)] + [:time (:time content)] + [:hr]] + [:div + (:content content)]]]))}))