From 325f72e0e07becb49532501ad83132c075a4d22c Mon Sep 17 00:00:00 2001 From: Brandon Lucas Date: Tue, 24 Feb 2026 22:27:17 -0500 Subject: [PATCH] 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 --- main.lux | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/main.lux b/main.lux index b4fc49f..b5533d0 100644 --- a/main.lux +++ b/main.lux @@ -108,7 +108,9 @@ fn htmlPostEntry(title: String, date: String, url: String): String = "
" + "

" + sectionTitle + "

" + "
" + postsHtml + "
" -fn htmlHomePage(siteTitle: String, snippetsHtml: String): String = "

" + siteTitle + "

" + "
" + "Βράνδων Λουκᾶς" + "
" + "

" + "Bitcoin Lightning Payments @ voltage.cloud" + "Bitcoin Privacy & Scalability @ payjoin.org." + "Love sovereign software & history." + "Learning Nix, Elm, Rust, Ancient Greek and Latin." + "

" + "
" + snippetsHtml + "
" +fn htmlWelcome(): String = "
Welcome!I'm a software builder by trade who's interested in too many things for my own good.Here's a sample:
  • Free and Open Source Software (FOSS): Bitcoin, Lightning Network, Payjoin, Linux, GrapheneOS, VPNs, etc.
  • History: Ancient Greek, Roman, American Revolution, and more.)
  • Biographies: Adams, Hamilton, Washington, Franklin, Oppenheimer, Ramanujan and more
  • 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.)
  • Languages: I'm currently learning Ancient Greek and Latin.
  • Fun: Bass guitar
" + +fn htmlHomePage(siteTitle: String, snippetsHtml: String): String = "

" + siteTitle + "

" + "
" + "Βράνδων Λουκᾶς" + "
" + "

" + "Bitcoin Lightning Payments @ voltage.cloud" + "Bitcoin Privacy & Scalability @ payjoin.org." + "Love sovereign software & history." + "Learning Nix, Elm, Rust, Ancient Greek and Latin." + "

" + "
" + htmlWelcome() + snippetsHtml + "
" fn htmlSnippetCard(content: String): String = "
" + "
" + content + "
" + "
" @@ -194,26 +196,29 @@ fn renderSnippets(snippetDir: String, files: List): List with {F }, } +fn insertString(sorted: List, item: String): List = { + 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): List = 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 = "
" + String.join(restCards, " + let gridHtml = "
" + String.join(snippetCards, " ") + "
" - 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)