sdoconnell

Thu 2021-06-10 23:00

  • Note
  • Posted: 2021-06-10 23:00 UTC

Man, it's June and this is the first time I've posted to my website in 2021. What can I say, Valheim is a hell of a drug.

Kidding (sort of). Yes, I lost a month of spare time to that game but really the reason I haven't posted in a while is because I've been doing some server consolidation and site moves/changes. As a part of that project, I've been wanting to convert my LAMP-driven personal website to a static site for quite some time. Security is prime driver for that decision, but portability is also a factor (more on that in a bit).

Unfortunately, in doing research and evaluation of a number of the popular static site generators I found that all existing SSGs suck*. So... I decided to write my own (why do I get the feeling that this is how all static site generators get started?).

I'm leveraging Python and Jinja2 templating to convert Markdown and YAML source files to static html. I had started exporting and reformatting all of the content on my website back in January or February, but then sort of lost inertia on the project. However, in the meantime I didn't want to add any new content until I'd gotten the new SSG built (otherwise I'd have to convert even more stuff), hence my lack of recent posts.

About a week ago I finally forced myself to sit down and knock out the first version of my custom SSG. It's less than 800 lines of code but it replicates my former website pretty faithfully, including features like my photo albums. One of my design goals for this new iteration was for the website to work both online and from a local directory, and some changes were required to paths and filenames to accomplish that. One of the reasons for this design requirement is that my near-to-medium term goals include being able to publish both on the web and via IPFS. In order to do that, the site needs to also work from a local filesystem directory.

For the most part, I was able to preserve existing URIs using server-side redirects for the old paths, pointing them to the new files. The primary exception is that the photo album structure was completely revised but that shouldn't be a big deal. The URIs for the photos themselves remain unchanged, and I'm more worried about links to previous notes or articles continuing to work.

This post comes shortly after the first push of the new static content. I've already been fixing a few bugs here and there as I write this, I'm sure there will be more.

* Okay, they don't necessarily suck but let's just say I couldn't find one SSG that would build my website content and maintain the structure I currently have, without practically re-writing the SSG itself. At which point, it just made sense to write my own from scratch.