4 [blog.gemtext :as gemtext]))
6 (defn with-page [_ & body]
11 _ _ _ _ _ __ ___ | |__
12 | | | | | | | '_ ` _ \\| '_ \\ Writing about things,
13 | |_| | |_| | | | | | | | | | sometimes.
14 \\__, |\\__,_|_| |_| |_|_| |_|
18 [:link "/tags.gmi" "All Tags"]
19 [:link "/pages/projects.gmi" "Projects"]
25 [:paragraph "-- text: CC-BY-SA-4.0; code: ISC (unless specified otherwise)"]
26 [:paragraph "Capsule proudly assembled with Clojure"]
27 [:link "https://git.omarpolo.com/blog/" "sources"])))
30 [{:keys [full? title-with-link?]}
31 {:keys [title date slug tags short body toot music xkcd] :as post}]
34 [:link (str "/post/" slug ".gmi") title]
35 [(if full? :h1 :h2) title])
38 [:paragraph (str "Written by Omar Polo on " (time/fmt-loc date)
40 (str " while listening to “" (:title music) "”"
41 (when-let [by (:by music)]
44 [:paragraph "Tagged with:"]
45 (map #(vector :link (str "/tag/" (name %) ".gmi") (str "#" (name %)))
48 [:link (str "https://xkcd.com/" xkcd) (format "Relevant XKCD – #%d" xkcd)])
52 (when short [:blockquote short]))
55 (defn home-page [{:keys [posts has-next has-prev nth]}]
59 (map (partial post-fragment {:title-with-link? true})
69 [:link (str "/" (inc nth) ".gmi")
72 (defn custom-page [{:keys [body]}]
74 (gemtext/parse body)))
76 (defn post-page [{:keys [title short] :as post}]
78 (post-fragment {:full? true}
81 (defn tags-page [tags]
85 (map #(vector :link (str "/tag/" (name %) ".gmi") (str "#" (name %)))
87 (compare (.toLowerCase (name a))
88 (.toLowerCase (name b)))) tags))))
90 (defn tag-page [tag posts]
92 [:h2 (format "Posts tagged with #%s" tag)]
94 [:paragraph "Note: note every post is currently available over Gemini."]
96 (map (partial post-fragment {:title-with-link? true})