commit - 9a594f34e404808b18d04a4ad36f77f36b6da245
commit + fe64383e20f07dd33bf3025a920ef645bf163145
blob - 6393d3b55d7c1e0098b5a3a200516fc75c79399e
blob + 6792c4acdc168647b54a66b6c2d76af3a09b2b07
--- src/blog/http.clj
+++ src/blog/http.clj
[hiccup.page :refer [html5 include-css]]
[commonmark-hiccup.core :refer [markdown->hiccup default-config]]))
-(defn link-item [{:keys [url text]}]
- [:li [:a {:href url} text]])
+(defn link-item [{:keys [url text title]}]
+ [:li [:a (cond-> {:href url}
+ title (assoc :title title))
+ text]])
-(defn header [{:keys [tags]}]
+(defn header [{:keys [skip-banner?]}]
(list
[:header
[:nav
(link-item {:url "/", :text "Home"})
(link-item {:url "/tags.html", :text "All Tags"})
(link-item {:url "/pages/projects.html", :text "Projects"})
- (link-item {:url "gemini://gemini.omarpolo.com" :text "gemini://"})]]
- [:div
- [:h1 [:a {:href "/"} "yumh"]]
- [:p "writing about things, sometimes."]]]))
+ (link-item {:url "gemini://gemini.omarpolo.com" :text "gemini://"
+ :title "This website in the gemini space."})]]
+ (when-not skip-banner?
+ [:div
+ [:h1 [:a {:href "/"} "yumh"]]
+ [:p "writing about things, sometimes."]])]))
(defn with-page
- [{:keys [title class description], :as d} & body]
+ [{:keys [title class description skip-banner?], :as d} & body]
(html5 {:lang "en"}
[:head
[:meta {:charset "utf8"}]
:async true
:src "//goatcounter.omarpolo.com/count.js"}]]))
+(defn link->images
+ "traverse `doc` and replace every link to an image to an `img` tag."
+ [doc]
+ (walk/prewalk
+ (fn [item]
+ (if-not (and (vector? item) (= (first item) :a))
+ item
+ (let [[_ {:keys [href] :as attrs} text] item]
+ [:p
+ [:a attrs
+ [:img {:src href
+ :alt text}]]])))))
+
(defn post-fragment
[{:keys [full? title-with-link?]}
{:keys [title date slug tags short body toot music xkcd gemtext?], :as post}]
"Older Posts ยป"])]))
(defn custom-page [{:keys [title body]}]
- (with-page {:title title}
+ (with-page {:title title
+ :skip-banner? true}
;; warning: hack ahead
(walk/prewalk
(fn [item]