Gleaming

Hello and welcome to the new blog! It looks almost the same as the old blog, but you might notice a few things are slightly different:

  • This page might have loaded a tiny bit faster. Most of the site is now free of javascript.
  • I got rid of that weird kebab menu icon that wasn't even an icon, just the unicode "⁝" character. The menu button now says "menu" and isn't that nice? I'm using the new Popover API, which lets me have an interactive menu popup (or over, I guess?) without any javascript. By default, clicking outside the popup closes it, which is also nice. I had been meaning to implement that same behavior in the old version of the blog, but never got around to it. Now I can have the behavior for free :)
  • Some colors and styles are slightly different. I tried to keep everything looking essentially the same, but I made a few changes that might be easier on the eyes and also I probably forgot to test a few things so some things might look weird. (Please let me know if they do!) All the styling is now done via pure, raw, unadulterated CSS. I have tried to avoid writing CSS for a long time, but it seems like it has finally caught me. And it wasn't even that bad! (I would argue that it's at most half as bad as this site looks; I take some of the responsibility for its appearance.) Since I first learned to code many years ago, CSS documentation (thanks Mozilla!) and browser dev tools (thanks Mozilla!) have both come a long way. That said, please don't judge me by my stylesheet. I'm still learning.
  • Categories are out, tags are in. I used to group posts in somewhat hierarchical categories, but I was inconsistent about actually adding new posts to their category and it was a complicated system and user experience. Now I can tag a post in its metadata while I write it and hopefully its more enjoyable to use the "tag browser" than the categories page. Also, one post can have multiple tags. Makes me wonder why I even bothered with categories in the first place...
  • Search no longer has a full-text option. You can search by post title, description, or "excerpt", where an "excerpt" is the first 200 characters of a post. I will get around to full-text search at some point.
  • Pagination is gone! I tried to keep it, but it proved challenging to implement without using javascript. The home page now only shows the 15 most recent posts. You can find older posts in the tags or via search.
  • The subscribe form is a lot less wordy. Why did I write so much just to say that I will email you once in a while?

Okay, but why??

Well.

When I first wrote my blog, my favorite programming language was Elm and it's really easy to make websites with Elm, so that's what I used. Also, Elm has an excellent library called elm-ui, that made it possible for me to style my whole website without learning a lick of CSS. Among other niceties, elm-ui let me center things horizontally without having a conniption. But CSS has gotten a lot better since 2020! Flexbox, for example, has made a lot of things a whole lot easier, obviating the need for things like elm-ui.

But so the first version of my blog was a Single-Page Application, or SPA. This means that my whole site of many different pages was really just 2 pages: a home page at index.html and a 404 page at not_found.html. These two pages let me control everything through Elm's Model-Update-View architecture, which made it very easy for me to reason about the site, but it had a couple downsides. First, things weren't great in the SEO world. Search engines weren't crawling my site because almost every page was actually served by not_found.html. And the text of the pages wasn't rendered without javascript, which means that search engines couldn't read my posts, which means that people couldn't search for my posts. (They probably can't search for them today either, because of how shitty searching the internet has become, but I digress.) Also, with every post that I wrote, every page on the site got bigger and slower because every page contained the entirety of the site.

And so I abandoned the SPA model and switched to using a tool called elm-pages. elm-pages is a static-site generator that you configure with elm and that lets you run elm in all your pages. This meant I was able to keep a lot of the original code, like the markdown renderer, while getting all the benefits of having static html pages that are good for SEO. On the other hand, elm-pages seemed sort of baroque. Elm advertises itself as a language for writing "web applications", but elm-pages, like any static-site generator, needs to run on my computer, not in your browser. So there are some sharp edges in trying to run elm-pages on "the backend". It sometimes felt hard to keep straight what code would run where, and how. (It did help me with SEO though!)

And all this while, Elm itself was struggling to build a strong developer community, after what appear to have been a series of missteps from its creator. People enthusiastic about functional programming, strong types, and high-quality error messages seem to be moving to Gleam. I am now among them.

From the jump, Gleam targetted compilation against the BEAM for backend development and in 2021 added support for compiling to javascript. For me, this means that the backend part of my blog (the static generation) and the interaction-heavy front-end parts (getting a random page, browsing tags, search) both feel first-class. There are also a ton of great packages out there under active development, so I've been able to get help (and contribute) in a way that never felt possible with Elm.

Also, I was able to delete node_modules which felt like a huge win! 77 outstanding vulnerability warnings gone in the blink of an eye.

***

Anyway....

Hope you enjoy the new site! I'm feeling excited about hacking on it some more!