Cobblers

To quote Robert Burton (1577—1640):

Him that makes shoes goes barefoot himself.

This is known nowadays as the no-self buffs trope:

Strangely often, the magician, witch, wizard, cleric, Evil Sorcerer, Mad Scientist, support class, etc. have the ability to bestow strange and amazing transformations, alterations, powers and enhancements on other people, for whichever reason, but are unable to use this ability to directly benefit themselves.

In my case, the fact that I spend my days dealing with databases, web pages, style sheets, JavaScript and the like, left me highly unmotivated to spend my off-work hours dealing with the same things. For years I used WordPress for my personal web site, with an off-the-shelf template that was good enough.

After a while I got fed up with WordPress’s security issues, as well as the hassle of dealing with plugin compatibility and spam — not just spam replies, but spam ads placed into plugins. I decided comment sections were a bad idea (don’t read the comments), so I thought I might as well switch to a static site generator.

I picked Hugo, mostly because I’ve got several thousand posts in my archive and the site generators written in scripting languages were annoyingly slow on a site that large. Even Hugo started to grind to a halt if I fed it one of the more sophisticated themes, and I didn’t understand the template language at all, so I picked the first acceptably fast simple theme I could find as a stopgap. That was 2016.

Meanwhile, web technology progressed. Things which used to be a total pain became relatively easy in every major browser. I also learned Go, and learned its templating language.

I also became dissatisfied with my stopgap solution. The CSS was pretty bloated at 82KB, considering how little it did. There was no built-in search, so I had to rely on Google custom site search, which seemed to do a bad job of keeping everything indexed and required handing data to Google. So earlier this year, I decided to build my own Hugo theme from the ground up.

Search was a particular challenge. I found a handy Hugo search plugin which made Hugo generate a JSON index file, which the search page then queried using Fuse.js. It seemed good, but when I pulled in all my content it slowed the browser to a crawl until Firefox gave me the “A script on this page is slowing your browser down” warning message and offered to kill it. However, after some more investigation I found another JavaScript search engine which is literally a half million times faster doing a simple search on a large quantity of data. The JSON data file is still pretty big, but it’s only a few megabytes before compression, which is only double the average page size on the web these days. I’ve decided that’s OK for now, since it only affects the search page. This page is a mere 24KB excluding fonts, and I haven’t finished optimizing yet.