BIT-101
Bill Gates touched my MacBook Pro
I felt the urge to write a blog post today. When I started to do so, I happened to look at the list of posts in my Hugo site repo and saw that the first post on this “new” blog was exactly one year ago today. So happy birthday static blog!
Speaking of static sites and this “new” site, there were two other versions of this blog before the one I started a year ago. The original started in 2003 and went until 2017. That got huge and unwieldy and I created a new one in 2017. Both of these were in Wordpress and I’ve kept them both up and somewhat functional ever since under at bit-101.com/2003 and bit-101.com/2017. But…
For one, the stuff going on around Wordpress these days is a bit ridiculous. I already distanced myself from WP for my own personal reasons around usability and functionality. But I want to even further distance myself from it now.
More than that though, even a dead Wordpress site takes a non-trivial amount of effort. Maintaining the install, keeping up to date with updates, not only of WP itself, but any plugins you have installed, maintaining the database. If I want to eventually switch hosts, I’ll need to migrate all that, which is not my idea of a good time.
So I went ahead and moved the 2017-2023 site over to a fully static Hugo site. There are a few projects that help with this. I found this one:
https://github.com/SchumacherFM/wordpress-to-hugo-exporter
This installs as a Wordpress plugin. Then you go to the plugin and tell it to export all your stuff. It took a few minutes and then prompted me to download a zip file which was a bare bones Hugo site setup, with every post as a markdown file, and a folder named wp-content/uploads
which contained all the images and other assets I’d uploaded to my WP site. From downloading the plugin, figuring out how it works, to getting the site download was maybe twenty minutes. Not bad.
Now I needed a theme. I copied over the theme from this blog and did some tweaking to everything to get it set up like I wanted. And the new static site worked… kind of.
There were a lot of places where I’d hardcoded things to bit-101.com/blog
- especially for images and other assets. This was actually already a problem as soon as I moved the site over to bit-101.com/2017
and I had made some progress on fixing these one by one via Wordpress. But now that I had all the markdown files in a folder on my local machine, it was pretty easy to just run sed
and fix all of these in pretty much one fell swoop.
There were also just a bunch of dead links. Again, having a folder full of markdown files made this easy to check. I used this node.js tool: https://github.com/tcort/markdown-link-check and it worked great. Those are all cleaned up. Fixed where possible, removed otherwise.
There were some formatting weirdnesses. Like Wordpress makes apostrophes into some funky HTML entity that I didn’t like so I sed
ed those back into simple single quote characters. A lot of the code blocks are still a mess of <pre>
tags instead of triple quoted blocks. I’ll probably go back and clean those up at some point.
Another problem was that the exported wp-content/uploads
folder seemed to be missing a few files. Rather than messing with that too much, I just copied over the same folder from the original Wordpress install that was already on my server. This had everything.
With that, the newly staticized site was up and running! Markdown and config checked into git. Assets backed up. No more WP updates, plugin updates, database updates, etc. to worry about. Migrating to a new host will just take updating and running my deploy script.
Next up will be the 2003-2017 site. This is a LOT bigger though, and will have way more broken links to fix and update. But I’ll probably do the initial export some time soon and get that out of the way.
And then there’s my Art From Code archived site. I did the same thing this year, where I moved the Wordpress version to a subdomain and created a Hugo site. I’ll staticize the archived one eventually too.
Another thing I’d like to do with these static sites is to implement search. The 2017 site has a lot of content and the 2003 site has I think something like 1200-1300 posts. Hugo has nothing for built in search, but there are some projects that will help. Generally I think it’s a matter of
Another thing to look into in the coming year.
Comments? Best way to shout at me is on Mastodon