Flesh out page structure

This commit is contained in:
heyarne 2021-07-29 21:53:42 +02:00
commit 85e79a8090
5 changed files with 105 additions and 25 deletions

View file

@ -1,9 +1,12 @@
(import janet-html :as html)
(import ./utils)
# defining the basic structure of each page
# thanks to https://css-tricks.com/emojis-as-favicons/
(defn as-html [h]
(html/encode (html/doctype :html5) [:html h]))
# thanks to https://css-tricks.com/emojis-as-favicons/
(def favicon
"data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌌</text></svg>")
@ -13,19 +16,8 @@
[:title (get-in data [:config :title])]
[:link {:rel "icon"
:href favicon}]
[:style
[```
body {
background: #fefefe;
}
path {
stroke: rebeccapurple;
fill: transparent;
stroke-width: 1.5px;
stroke-linecap: round;
}
```]]])
[:link {:rel "stylesheet"
:href (get-in data [:config :stylesheet])}]])
# below are some functions we need for the unique svgs generated for each page
# arc drawing in svg is a bit messy. these two links helped me:
@ -96,6 +88,30 @@
(default raw? false)
(as-html [(html-head data)
[:body
[:header
(ten-print body) ]
(if raw? (html/raw body) body) ]]))
[:main
[:header
(ten-print body)]
[:article (if raw? (html/raw body) body)]]]]))
#
# different page types
#
(defn debug [jdn]
(string/format "%j" jdn))
(defn home [data]
(base data
[[:h1 "Projects"]
[:ul
[:li "Berliner Winter"]
[:li "Vanilla Sky"]
[:li "All My Friends"]
[:li "Kosmopolit"]]
[:h1 "Recent Posts"]
[:ul
(map (fn [post]
[:li [:a {:href (utils/slugify-content data post)} (post "title")]]) (data :posts))]]))
(defn post [data item]
(base data (bagatto/mmarkdown->html (item :contents)) true))