aboutsummaryrefslogtreecommitdiff
path: root/src/dionysus/web/utils.clj
blob: 771bd6dc8eac0fefc4e2c8d80d02692cd017d3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(ns dionysus.web.utils
  (:require [hiccup2.core :as html]
            [dotenv :as env]))

(def title (delay (or (env/env "TITLE") "Dionysus")))

(defn render-html [src]
  (-> src
      html/html
      str))

(defn render-page [title & src]
  (-> [:html {:lang "de"}
       [:head
        [:meta {:charset "UTF-8"}]
        [:meta {:name "viewport" :content "width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"}]
        [:link {:rel "stylesheet" :href "/assets/style.css"}]
        [:title title]]
       (-> src
           (conj :body)
           vec)]
      render-html))