My personal website
1import envoy
2import gleam/javascript/promise.{type Promise}
3import gleam/result
4import highlight.{type Highlighter}
5
6const env_commit_hash = "TANGLED_COMMIT_SHA"
7
8const env_gleam_version = "GLEAM_VERSION"
9
10pub type Context {
11 SiteMeta(commit_hash: String, gleam_version: String, highlighter: Highlighter)
12}
13
14pub fn fetch() -> Promise(Context) {
15 use highlighter <- promise.map(highlight.highlighter(highlight_languages))
16 let commit_hash = env_commit_hash |> envoy.get |> result.unwrap("hash")
17 let gleam_version = env_gleam_version |> envoy.get |> result.unwrap("161.789")
18 SiteMeta(commit_hash:, gleam_version:, highlighter:)
19}
20
21// We could compute these from the pages, but I don't think it's worth it...
22const highlight_languages = [
23 "gleam",
24 "javascript",
25 "css",
26 "html",
27 "toml",
28]