1
0
Fork 0
website/src/site/core.clj

65 lines
2.6 KiB
Clojure
Raw Normal View History

2019-10-27 16:20:04 -05:00
(ns site.core
2020-09-28 02:47:53 -05:00
(:require [hiccup.page :as hp]))
2020-05-12 03:24:27 -05:00
2019-10-27 16:20:04 -05:00
2020-09-28 02:47:53 -05:00
(defn format-time [time] (.format (-> time .toInstant (.atZone (java.time.ZoneId/systemDefault)) .toLocalDate) (java.time.format.DateTimeFormatter/ofPattern "MMM d, yyyy")))
2020-09-30 23:37:29 -05:00
(defn page-header [& [title]]
[:head
[:meta {:charset "utf-8"}]
2022-04-03 17:13:29 -05:00
[:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
2020-09-30 23:37:29 -05:00
[:link {:rel "stylesheet" :href "/main.css"}]
[:link {:rel "stylesheet" :href "/extra/emacs.css"}]
;;[:script {:src "/main.js"}]
2022-01-01 16:58:02 -06:00
[:title (when title (str title " - ")) "Homepage of Kaan Barmore-Genç"]
2020-09-30 23:37:29 -05:00
[:link {:href
"https://fonts.googleapis.com/css2?family=Ubuntu+Mono&family=Ubuntu:ital,wght@0,400;0,700;1,400;1,700&display=swap"
:rel "stylesheet"}]])
(defn page-left-column [& [slug]]
[:div.sidebar.column
(when (not= slug "index") [:a.home {:href "/"} "Home"])
2022-01-01 16:58:02 -06:00
[:img.picture {:alt "A photo of Kaan, after his OOPSLA 2019 talk." :src "/img/profile.jpg"}]
[:div.name "Kaan Barmore-Genç"]
2022-03-13 16:50:27 -05:00
[:div.title "M.S."]
2021-05-11 17:32:00 -05:00
[:div.spacer]
2022-01-01 02:50:09 -06:00
[:div.title "Software Engineer"]
2021-05-11 17:32:00 -05:00
[:div.affiliation [:a {:href "http://dendron.so/"} "Dendron"]]
[:div.spacer]
2022-01-01 02:50:09 -06:00
[:span [:a.email {:href "mailto:kaan@bgenc.net"} "kaan@bgenc.net"] [:a.gpg {:href "/extra/kaangenc.gpg"} "GPG key"]]
2020-09-30 23:37:29 -05:00
[:a.github {:href "https://github.com/SeriousBug"} "Github"]
2021-03-20 15:48:09 -05:00
[:a.linkedin {:href "https://www.linkedin.com/in/kaan-genc-8489b9205/"} "LinkedIn"]
2020-09-30 23:37:29 -05:00
[:a.cv {:href "/extra/cv.pdf"} "CV"]
2022-02-02 11:54:50 -06:00
[:a.blog {:href "/blog/"} "Blog"]
[:a.mastodon {:href "https://mastodon.technology/@kaan" :rel "me"} "Mastodon"]])
2021-03-20 15:48:09 -05:00
2020-09-30 23:37:29 -05:00
2021-05-11 17:32:00 -05:00
2020-09-28 02:47:53 -05:00
(defn page [{global-meta :meta posts :entries post :entry}]
2019-10-27 16:20:04 -05:00
(hp/html5
2020-09-30 23:37:29 -05:00
(page-header (:title post))
(page-left-column (:slug post))
2020-09-28 02:47:53 -05:00
(if (= "index" (:slug post))
;; Index page
[:div.main.column (:content post)]
;; Blog post
[:div.main.column
[:h1.post-title (:title post)]
2022-01-01 02:50:09 -06:00
(when (:date post) [:div.date "Written at " (-> post :date format-time)])
2020-09-28 02:47:53 -05:00
(when (:modified post) [:div.modified "Last edited at " (-> post :modified format-time)])
2022-01-01 02:50:09 -06:00
(when (not (:no-ttr post)) [:div.ttr (:word-count post) " words, takes about " (:ttr post) " minutes to read"])
2020-09-28 02:47:53 -05:00
(:content post)])))
2020-09-30 23:37:29 -05:00
(defn page-blog [{global-meta :meta posts :entries post :entry}]
(hp/html5
(page-header "Blog")
(page-left-column)
(into [:div.main.column [:h1 "My thoughts on software & computer science"]]
(map (fn [{:keys [title permalink ttr date] :as post}]
[:a.post-listing {:href permalink} [:span.title title] [:br] [:span.ttr ttr " minute read, "] [:span.date (format-time date)]])
2021-05-11 17:32:00 -05:00
posts))))