From 075436487eb240fc0be6fd6a2e269f39619608fa Mon Sep 17 00:00:00 2001 From: SouthFox Date: Fri, 1 Sep 2023 08:37:07 +0800 Subject: [PATCH] [hugo/refactor] use hiccup.page ns --- src/main/backend/hugo/site.clj | 41 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/backend/hugo/site.clj b/src/main/backend/hugo/site.clj index 8d2f429..ff81a79 100644 --- a/src/main/backend/hugo/site.clj +++ b/src/main/backend/hugo/site.clj @@ -1,6 +1,6 @@ (ns backend.hugo.site (:require [backend.handlers :as handlers] - [hiccup2.core :as hiccup])) + [hiccup.page :as page])) (defn build-hu-post @@ -8,23 +8,22 @@ (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 "viewport" :content "width=device-width, initial-scale=1.0"}] - [:meta {:name "referrer" :content "no-referrer"}] - [:link {:rel "stylesheet" :href "/css/app.css"}]] - [:body - [:div {:id "app"} - [:div {:class "container p-2 mx-auto"} - [:div {:class "flex flex-row flex-wrap py-4"} - [:div {:class "w-full sm:w-1/3 md:w-1/4 px-2"} - [:div {:class "sticky top-0 p-4 bg-slate-300 rounded-xl w-full"} - [:div (:catalog content)]]] - [:div {:class "w-full sm:w-2/3 md:w-3/4 pt-1 px-2"} - [:h1 (:title content)] - [:time (:time content)] - [:hr] - [:div - (:content content)]]]]]]]))})) + :body (page/html5 {:escape-strings? false} + [:html + [:head + [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}] + [:meta {:name "referrer" :content "no-referrer"}] + (page/include-css "/css/app.css")] + [:body + [:div {:id "app"} + [:div {:class "container p-2 mx-auto"} + [:div {:class "flex flex-row flex-wrap py-4"} + [:div {:class "w-full sm:w-1/3 md:w-1/4 px-2"} + [:div {:class "sticky top-0 p-4 bg-slate-300 rounded-xl w-full"} + [:div (:catalog content)]]] + [:div {:class "w-full sm:w-2/3 md:w-3/4 pt-1 px-2"} + [:h1 (:title content)] + [:time (:time content)] + [:hr] + [:div + (:content content)]]]]]]])}))