Site Overhaul (and written in Go!)
I've finally decided to flesh out my personal website. Many years ago, butlerpc.net was a custom PHP site with a WordPress blog, then a simple single page overview, and then it was reduced to basically a digital business card.
Over the years when I stopped the blog, I tended to just put random things on gist.github.com, for my own reference but also for others. Some of these gists actually got picked up by search engines, so I feel that it's time to maintain a personal blog once again.
PHP has always been my strongest programming language; since I have had so much professional work revolving around PHP, I can do pretty much anything with it, and quite fast and efficiently. However, for personal development I have decided to redo this website in Go! It turns out that Go is actually very well suited even for personal websites — even though it is a compiled language, it has a great number of time saving syntaxes and developer workflows that can make it almost seem like one. Plus, it's super fast and memory efficient, and will be a great learning experience for anyone.
Before doing this in Go, I actually experimented with using something React-based, all javascript. I gave the Gatsby framework a try, and did have it running that way for about a week or two. However, doing JavaScript-centric development work is just not something that brings joy to me (yet). Furthermore, just building the site for deployment took a lot of time and memory, even with a small starter site.
I was intrigued about techniques such as Ruby on Rails Hotrails and Laravel's Livewire which attempt to provide a more UI rich, SPA (Single Page App) experience to non-JavaScript languages. And then I heard about HTMX and decided to give that a try.
This is a fairly simple site right now, so there is not much to talk about. But for the basics, the
top navigation is htmx "boosted", which basically means that the HTMX framework (a 46 kB file) listens
for events on the top nav anchor tags. It intercepts clicks and looks at the href, performing an AJAX
GET request at the given URL. Then it simply swaps the whole <body>
DOM element with the body of
the response. However, it does this intelligently (I assume), keeping any element attached event handlers and likely
skipping elements that haven't changed. This means that my backend basically assumes that every page
is loaded in full like the old days. You just have to write HTML and CSS. Vanilla JavaScript can be
sprinkled in as needed, following progressive enhancement techniques.
This article, and all articles on this blog, were written without the use of any AI, GPT, or Language Learning Models. It's old fashioned I guess.