This blog is now (mostly) static
I used to write more often, back when it was as simple as typing stuff in LiveJournal. Then the platform was no longer suitable, and life also took over so I stopped writing for a while. By the time I felt like doing it again, I thought it’d be more sustainable to just self-host my blog like I do pretty much everything else1.
Back then, I went a little overboard and set up a whole WordPress — which was a lot of work but also a great opportunity to try out various ways to keep PHP in some chroot jail.
And for a time, it was good.
No, really, it was! I found a nice sober theme, I could copy-paste Markdown directly into the editor and syntax highlighting worked great for the snippets of emulator code I was posting. Thumbnails worked just fine when I posted links to my posts on social media, and the site itself looked fine in most browsers I could throw at it.
Then, the emulator-related articles started growing more sporadic. Every time I sat down to write, months had passed, and the first thing I had to do was WordPress maintenance, which wasn’t really fun.
Then, I wanted to lightly edit some old posts because of typos or some awkward wording, and in so doing realized WordPress had a tendency to just completely ruin the formatting of code blocks.
At some point I was like “Hey, I could write a post about this thing” and my brain would go “But I don’t want to bother with WP right now” and thus things remained unwritten2.
Hey, I should start yet another side project!
The fact I could write drafts in Markdown and paste them into WordPress made me realize pretty early on that I didn’t really need a whole blog engine. Why not just write Markdown and post the resulting HTML? Surely there are toolkits for that!
Well, there are! Just look up “static site generator”.
In the end, I went with Hugo, not only because it was one of the top results I got in various search engines, but also because I already had some passing familiarity with Go templates, having used them as a dirty way to generate code for CPU instructions in Goholint.
It looked pretty good and well documented. That is, until I tried rolling out my own theme, and then I realized their documentation was somewhat lacking, the core concepts were sometimes a bit obscure, and it wasn’t always easy to find what I was looking for3.
It’s just boilerplate code
It’s fine. That’s not the first time I have to spend a lot of time just setting things up the way I like them — if you ever wrote your own LaTeX template, you know how it feels.4
So it took some trial and error, but some half-assed HTML/CSS later, I had a crude, yet static site that looked close enough to the old WordPress that I decided to commit to the whole thing.
Importing all the articles wasn’t all that bad — primarily because there only were like twenty of them anyway — and then I could do what wasn’t possible before5: add functionalities by writing my own template snippets.
Being able to properly version my blog posts in git was also incredibly satisfying, for some reason.
And the rest looks good too! I have pretty URLs, Open Graph, richer syntax highlighting… even an RSS feed, all of that pretty much out of the box!
“Coming Soon”
I only ended up with mildly crappy HTML that I haven’t quite tested on a lot of platforms, but it’s not like the site’s layout is very complicated so as long as it’s legible, it’s Good Enough™.
I even procrastinated a bit further and added a dark mode option. It was CSS-only at first, but then it wouldn’t persist across pages, so I slapped on half a dozen lines of JavaScript and that’s why this site is only “mostly” static. I was still careful to make sure it was optional, so the new site will still totally work with JS disabled — I use NoScript and I can’t recommend it enough.
The one thing that worked better on the WordPress theme was the mobile version. But the one I have now doesn’t require, well, WordPress. So, you know, all in all, a net benefit, still.
So there we are. It’s the same site as before, just a little more crappy-looking, and I no longer need to worry about it being a security risk anymore.
I still want to write a couple scripts to automate a few things, like publishing dates and such, but I can do that later.
For the time being, I’ll just keep spewing nerdy stuff here, hopefully at a more regular rate. So, see you next year, I guess!
-
Whether that was a good idea remains unclear to this day, but I’m still extremely happy with my server at the time of this writing! ↩︎
-
Also my readership is, like, three people and I can bother them with my nerdy ideas via other channels anyway. ↩︎
-
Admittedly, I’ve been spoiled by Django in that regard. More than once I got this close to discarding the whole static site idea and rolling my own blog site in Django. As one does. ↩︎
-
And regardless of the framework I picked, writing HTML and CSS is still a pain anyway. ↩︎
-
Yeah, okay, it was possible before, but I wasn’t going to start writing PHP. I do have limits. ↩︎