New Site

· 294 words · 2 minute read

For a while now, I’ve thought Wordpress was highly overkill for what I do with this blog. Coupled with the security and logistic issues arising from running a PHP app accessing an SQL database, and the fact that I was more likely to forget my post in the process of updating Wordpress, this lack of need made me seriously consider a static site generator.

I hadn’t actually heard that such utilities exist, so I did the stubborn thing and started thinking about writing my own. In the end, I realized that I didn’t have a good idea of how to build such a thing. After giving up, I did a web search and wandered from generator to generator, always finding issues. Pelican’s Wordpress importer complained about some version mismatch. I couldn’t find a Jekyll theme I liked and had trouble figuring out how to write my own.

In the end, I found Hugo. Hugo makes it easy to overwrite template paramaters, as it provides the same folders from a theme in a project’s root directory; files in these folders will completely overwrite equivalents from the theme. Perfect for a tinkerer.

In the process, I used wordpress-to-hugo-exporter to transition the old site. The tool left a fair amount of cleanup for my more manually-formatted content from Wordpress. For example, I found various <figure> tags in some areas.

The image tags were easy to clean up with some good knowledge of sed:

sed -i -E "s:<img.*src=\"(.*)\" alt=\"(.*)\" width.*:\![\2]\(\1\):g" *.md

This command did an excellent job of converting everything like \<img src="url" alt="something"\> to the Markdown equivalent of \!\[something\]\(url\).

And with that, I made my final wordpress backup, moved the new site in, and simply removed mariadb and anything to do with PHP. Hooray for simpler systems.