Compare commits

...

1 Commits

Author SHA1 Message Date
325f72e0e0 fix: add Welcome section and fix homepage snippet layout
Add the hardcoded Welcome card matching the live elmstatic site.
Put all snippets into the 2-column grid instead of making the
first one full-width. Sort snippets by filename to ensure correct
display order.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 22:27:17 -05:00

View File

@@ -108,7 +108,9 @@ fn htmlPostEntry(title: String, date: String, url: String): String = "<div class
fn htmlPostList(sectionTitle: String, postsHtml: String): String = "<div class=\"page w-[80%] flex flex-col gap-8\">" + "<h1 class=\"text-4xl text-center font-bold w-full\">" + sectionTitle + "</h1>" + "<div class=\"flex flex-col gap-4\">" + postsHtml + "</div></div>"
fn htmlHomePage(siteTitle: String, snippetsHtml: String): String = "<h1 class=\"unifrakturmaguntia-regular text-6xl text-center w-full\">" + siteTitle + "</h1>" + "<div class=\"font-bold text-4xl italic text-center w-full\">" + "Βράνδων Λουκᾶς" + "</div>" + "<h2 class=\"text-xl text-center flex flex-col\">" + "<span>Bitcoin Lightning Payments @ voltage.cloud</span>" + "<span>Bitcoin Privacy &amp; Scalability @ payjoin.org.</span>" + "<span>Love sovereign software &amp; history.</span>" + "<span>Learning Nix, Elm, Rust, Ancient Greek and Latin.</span>" + "</h2>" + "<div class=\"flex flex-col gap-4 w-full\">" + snippetsHtml + "</div>"
fn htmlWelcome(): String = "<div class=\"flex flex-col gap-4 border border-gray-500 p-8 rounded-sm max-h-150 overflow-y-auto text-wrap break-words\"><span class=\"flex flex-col gap-4\"><span class=\"text-center\">Welcome!</span><span class=\"text-center\">I'm a software builder by trade who's interested in too many things for my own good.</span><span class=\"text-center\">Here's a sample:</span><ul class=\"list-outside ml-8\"><li class=\"list-disc\">Free and Open Source Software (FOSS): Bitcoin, Lightning Network, Payjoin, Linux, GrapheneOS, VPNs, etc.</li><li class=\"list-disc\">History: Ancient Greek, Roman, American Revolution, and more.)</li><li class=\"list-disc\">Biographies: Adams, Hamilton, Washington, Franklin, Oppenheimer, Ramanujan and more</li><li class=\"list-disc\">Philosophy, psychology, Christianity: Influenced by Cicero, Nietzsche, Karl Popper, Dostoevsky, Will Durant, Oliver Sacks, Jung, Seneca, and more. Attempting to read Kierkegaard, but finding it impenetrably difficult yet joyful.)</li><li class=\"list-disc\">Languages: I'm currently learning Ancient Greek and Latin.</li><li class=\"list-disc\">Fun: Bass guitar</li></ul></span></div>"
fn htmlHomePage(siteTitle: String, snippetsHtml: String): String = "<h1 class=\"unifrakturmaguntia-regular text-6xl text-center w-full\">" + siteTitle + "</h1>" + "<div class=\"font-bold text-4xl italic text-center w-full\">" + "Βράνδων Λουκᾶς" + "</div>" + "<h2 class=\"text-xl text-center flex flex-col\">" + "<span>Bitcoin Lightning Payments @ voltage.cloud</span>" + "<span>Bitcoin Privacy &amp; Scalability @ payjoin.org.</span>" + "<span>Love sovereign software &amp; history.</span>" + "<span>Learning Nix, Elm, Rust, Ancient Greek and Latin.</span>" + "</h2>" + "<div class=\"flex flex-col gap-4 w-full\">" + htmlWelcome() + snippetsHtml + "</div>"
fn htmlSnippetCard(content: String): String = "<div class=\"flex flex-col gap-4 border border-gray-500 p-8 rounded-sm max-h-150 overflow-y-auto text-wrap break-words\">" + "<div><div class=\"markdown\">" + content + "</div></div>" + "</div>"
@@ -194,26 +196,29 @@ fn renderSnippets(snippetDir: String, files: List<String>): List<String> with {F
},
}
fn insertString(sorted: List<String>, item: String): List<String> = {
match List.head(sorted) {
None => [item],
Some(first) => if item <= first then List.concat([item], sorted) else match List.tail(sorted) {
Some(rest) => List.concat([first], insertString(rest, item)),
None => [first, item],
}
}
}
fn sortStrings(items: List<String>): List<String> = List.fold(items, [], insertString)
fn writeHomePage(outputDir: String, contentDir: String, siteTitle: String, siteDesc: String): Unit with {File} = {
let snippetDir = contentDir + "/snippets"
let snippetEntries = if File.exists(snippetDir) then {
let entries = File.readDir(snippetDir)
List.filter(entries, fn(e: String): Bool => String.endsWith(e, ".md"))
let mdFiles = List.filter(entries, fn(e: String): Bool => String.endsWith(e, ".md"))
sortStrings(mdFiles)
} else []
let snippetCards = renderSnippets(snippetDir, snippetEntries)
let firstCard = match List.head(snippetCards) {
Some(c) => c,
None => "",
}
let restCards = match List.tail(snippetCards) {
Some(rest) => rest,
None => [],
}
let gridHtml = "<div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">" + String.join(restCards, "
let gridHtml = "<div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">" + String.join(snippetCards, "
") + "</div>"
let snippetsHtml = firstCard + "
" + gridHtml
let body = htmlHomePage(siteTitle, snippetsHtml)
let body = htmlHomePage(siteTitle, gridHtml)
let pageTitle = "Bitcoin Lightning Developer & Privacy Advocate | " + siteTitle
let html = htmlDocument(pageTitle, siteDesc, body)
File.write(outputDir + "/index.html", html)