···1515import gleam/time/timestamp
1616import glentities
1717import homepage
1818-import homepage/stuff.{type Entry, type Model, type Route, Entry, Index, Model}
1818+import homepage/stuff.{type Entry, type Model, type Route, Entry, Model}
1919import lustre/element
2020import simplifile
2121import webls/rss
···8989 }
9090}
91919292+/// I used to just replace with self+new but this seems more neat
9393+/// need to see what is actually more efficient, I doubt it makes much difference though.
9494+///
9595+/// The final string is either stored within an Ok (if been appended), or within an Error
9696+/// (if the string remained the same), which is where it may be an improvement over my
9797+/// replacement approach
9898+fn string_insert_after(
9999+ in string: String,
100100+ on pattern: String,
101101+ with new: String,
102102+) -> Result(String, String) {
103103+ case string.split_once(string, on: pattern) {
104104+ Error(Nil) -> Error(string)
105105+ Ok(#(before, after)) -> {
106106+ Ok(before <> new <> after)
107107+ }
108108+ }
109109+}
110110+92111fn prepopulate_html() {
93112 use main_index_html: String <- try_annot(
94113 simplifile.read("./dist/index.html"),
95114 "Prepopulation mode expects that the site already be built, but could not load ./dist/index.html",
96115 )
116116+ use _ <- try_annot(
117117+ simplifile.write(to: "./dist/unpopulated.html", contents: main_index_html),
118118+ "Could not write html to ./dist/unpopulated.html",
119119+ )
120120+ io.println("✅\tWrote: `./dist/unpopulated.html`")
97121 let main_model: Model = homepage.init()
98122 let map_entries = fn(cb: fn(Entry) -> Result(Nil, String)) -> Result(
99123 Nil,
···108132 |> element.to_string()
109133 let meta_description_tag: String =
110134 "<meta name=\"description\" content=\"" <> entry.description <> "\">"
111111- let link_canonical = case entry.route {
112112- Index -> ""
113113- _ ->
114114- "<link rel=\"canonical\" href=\"" <> to_canonical(entry.route) <> "\" />"
115115- }
135135+ let link_canonical =
136136+ "<link rel=\"canonical\" href=\"" <> to_canonical(entry.route) <> "\" />"
116137 let title =
117138 homepage.to_title(entry.route)
118139 |> glentities.encode(glentities.Hex)
···137158 )
138159139160 use _ <- try_annot(
140140- simplifile.write(html, html_file_path),
161161+ simplifile.write(to: html_file_path, contents: html),
141162 "Could not write html to " <> html_file_path,
142163 )
143164 Ok(io.println("✅\tWrote: `" <> html_file_path <> "`"))
144144-}
145145-146146-/// I used to just replace with self+new but this seems more neat
147147-/// need to see what is actually more efficient, I doubt it makes much difference though.
148148-///
149149-/// The final string is either stored within an Ok (if been appended), or within an Error
150150-/// (if the string remained the same), which is where it may be an improvement over my
151151-/// replacement approach
152152-fn string_insert_after(
153153- in string: String,
154154- on pattern: String,
155155- with new: String,
156156-) -> Result(String, String) {
157157- case string.split_once(string, on: pattern) {
158158- Error(Nil) -> Error(string)
159159- Ok(#(before, after)) -> {
160160- Ok(before <> new <> after)
161161- }
162162- }
163165}
164166165167fn to_canonical(route: Route) {
+57-6
src/homepage.gleam
···11-import gleam/bool
22-31/// Post data -------------------------------------------------------------------
42///
53/// Some special tags:
···433431const highlighted_posts = [900]
434432435433const pages = [
436436- // If index isn't first, things break.
434434+ Entry(
435435+ Index,
436436+ "Homepage",
437437+ Date(2026, March, 16),
438438+ NotFound(uri.empty),
439439+ "Welcome to my personal site!",
440440+ ),
441441+ Entry(
442442+ Me,
443443+ "About me",
444444+ Date(2026, March, 16),
445445+ Index,
446446+ "My about-me page, on here I try to describe myself a bit",
447447+ ),
448448+ Entry(
449449+ Portfolio,
450450+ "Portfolio",
451451+ Date(2026, March, 16),
452452+ Me,
453453+ "On this page you'll find my portfolio and some active projects!",
454454+ ),
455455+ Entry(
456456+ Links,
457457+ "Links",
458458+ Date(2026, March, 16),
459459+ Me,
460460+ "Some links to places I can be found on the internet!",
461461+ ),
462462+ Entry(
463463+ Posts,
464464+ "Posts",
465465+ Date(2026, March, 16),
466466+ Index,
467467+ "Mostly blog posts from Mar Bloeiman (@strawmelonjuice)",
468468+ ),
469469+ Entry(
470470+ Sitemap,
471471+ "Sitemap",
472472+ Date(2026, March, 16),
473473+ Index,
474474+ "Visual sitemap for strawmelonjuice.com.",
475475+ ),
476476+ Entry(
477477+ AllAndEverything,
478478+ "/everything page",
479479+ Date(2026, March, 16),
480480+ Index,
481481+ "A collection of content from all visible pages and posts on strawmelonjuice.com, useful for quickly finding specific sentences etc.",
482482+ ),
437483 Entry(
438484 Index,
439485 "Homepage",
···504550 "Ollie",
505551 "https://nuv.sh",
506552 "https://avatar.tangled.sh/7e06ae27ffa435ccb999e6852c3bdf4172bbfe5de27f40c851a1a8ae222b6962/did:plc:cezmtk5bb4zipkps3abnjjl6",
553553+ "",
507554 ),
508508- #("Gleam", "https://gleam.run/", "https://gleam.run/images/lucy/lucy.svg"),
555555+ #("Gleam", "https://gleam.run/", "https://gleam.run/images/lucy/lucy.svg", ""),
509556 #(
510557 "Tangled.sh",
511558 "https://blog.tangled.org",
512559 "https://tangled.org/static/logos/dolly.svg",
560560+ "bg-black",
513561 ),
514562]
515563···582630 ),
583631 Badge(
584632 img_url: "/img/badges/blinkiesCafe-L1.gif",
585585- img_alt: "Blinkies Cafe",
633633+ img_alt: "the autism badge",
586634 img_title: "I GOT AUTISM",
587635 clickable_url: "self",
588636 text_badge: "",
···677725678726import chilp
679727import chilp/widget
728728+import gleam/bool
680729import gleam/dict
681730import gleam/function
682731import gleam/int
···22272276 ],
22282277 [
22292278 html.img([
22302230- attribute.class("w-full h-full rounded-full object-cover"),
22792279+ attribute.class(
22802280+ "w-full h-full rounded-full object-cover " <> person.3,
22812281+ ),
22312282 attribute.alt("profile icon"),
22322283 attribute.src(person.2),
22332284 ]),