summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJake Zerrer <him@jakezerrer.com>2025-08-12 11:42:46 -0400
committerJake Zerrer <him@jakezerrer.com>2025-08-12 11:42:46 -0400
commite7583ac9782b006139188ebe6a3c2d33b980bf33 (patch)
tree2f185e664bde0e36f6de06902b7ee8144981e558 /src
parenta921181505370e8db61d79606d8530105022ff18 (diff)
Flesh out page outline
Diffstat (limited to 'src')
-rw-r--r--src/core.clj42
-rw-r--r--src/pages.clj56
2 files changed, 59 insertions, 39 deletions
diff --git a/src/core.clj b/src/core.clj
index e36b8bb..4fc90a9 100644
--- a/src/core.clj
+++ b/src/core.clj
@@ -1,42 +1,6 @@
(ns core
- (:require [borkdude.html :refer [html]]
- [clojure.java.io :as io]
- [clojure.string :as str]))
-
-(defn template [body]
- (html [:html [:head] [:body [:<> body]]]))
-
-(defn home []
- (template
- (html
- [:h1 "home"])))
-
-(defn about []
- (template
- (html
- [:h1 "about"])))
-
-(defn this-life
- "blog post about this life"
- []
- (template
- (html
- [:h1 "This life"])))
-
-(defn something-else
- "blog post about something else"
- []
- (template
- (html
- [:h1 "Something else"])))
-
-(something-else)
-
-(def pages
- {"/" home
- "/about" about
- "/blog/this-life" this-life
- "/blog/something-else" something-else})
+ (:require [clojure.java.io :as io]
+ [pages :refer [pages]]))
(defn clean []
(let [target-dir (io/file "target")]
@@ -49,7 +13,7 @@
(.delete dir)))))
(defn build []
- (doseq [[path page-fn] pages]
+ (doseq [[path page-fn] (pages)]
(let [target-path (if (= path "/")
"target/html/index.html"
(str "target/html" path "/index.html"))
diff --git a/src/pages.clj b/src/pages.clj
new file mode 100644
index 0000000..4b9a617
--- /dev/null
+++ b/src/pages.clj
@@ -0,0 +1,56 @@
+(ns pages
+ (:require [borkdude.html :refer [html]]))
+
+(def home-uri "/")
+(def books-2025-uri "/books-2025")
+
+(defn template [body]
+ (html
+ [:html
+ {:style {:font-family "monospace"}}
+ [:head
+ [:meta {:charset "UTF-8"}]]
+ [:body
+ [:<> body]]]))
+
+(defn home []
+ (template
+ (html
+ [:<>
+ [:p "Hello."]
+ [:p "My name is Jake Zerrer. This is where I keep things online. Look around."]
+ [:ul
+ (map
+ (fn [[uri name]]
+ (html
+ [:li [:a {:href (str uri)} name]]))
+ [[books-2025-uri "2025 reading list"]])]])))
+
+(defn page [body]
+ (template
+ (html
+ [:<>
+ [:p [:a {:href "/"} "< home"]]
+ body])))
+
+(defn books-2025
+ []
+ (page
+ (html
+ [:<>
+ [:h1 "Incomplete 2025 reading list"]
+ [:ul
+ [:li "The Places in Between (Rory Stewart)"]
+ [:li "Either/Or: A Fragment of Life (Søren Kierkegaard)"]
+ [:li "The Philosophy of History (G. W. F. Hegel)"]
+ [:li "This Life: Secular Faith and Spiritual Freedom (Martin Hägglund)"]
+ [:li "Mating (Normal Rush)"]]])))
+
+(defn pages []
+ {home-uri home
+ books-2025-uri books-2025})
+
+(comment
+ (require '[repl :refer [restart build]])
+ (restart)
+ (build))