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 "Blog proudly generated 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) (when-let [by (:by music)]
43 [:paragraph "Tagged with:"]
44 (map #(vector :link (str "/tag/" (name %) ".gmi") (str "#" (name %)))
47 [:link (str "https://xkcd.com/" xkcd) (format "Relevant XKCD – #%d" xkcd)])
51 (when short [:blockquote short]))
54 (defn home-page [{:keys [posts has-next has-prev nth]}]
58 (map (partial post-fragment {:title-with-link? true})
68 [:link (str "/" (inc nth) ".gmi")
71 (defn custom-page [{:keys [body]}]
73 (gemtext/parse body)))
75 (defn post-page [{:keys [title short] :as post}]
77 (post-fragment {:full? true}
80 (defn tags-page [tags]
84 (map #(vector :link (str "/tag/" (name %) ".gmi") (str "#" (name %)))
86 (compare (.toLowerCase (name a))
87 (.toLowerCase (name b)))) tags))))
89 (defn tag-page [tag posts]
91 [:h2 (format "Posts tagged with #%s" tag)]
93 (map (partial post-fragment {:title-with-link? true})