Self-Hosted Blog Part 4 - The Blog

In part 3 we got the infrastructure up and running, now it’s time to get a blog created, building, and containerized. First, in the requirements, I had already decided I was going to build a static site to keep things simple. For this tutorial, I looked at a number of options, but you can substitute anything that builds a static site.

There’s been a recent revolution in static sites with a number of options for how to build them. I looked at two options seriously, Gatsby and Hugo. I initially went with Gatsby given it’s JavaScript and React roots and my experience in those domains, but I ran into numerous issues trying to find a starter kit that would work for my simple blog I was trying to create. Hugo turned out to be much simpler and easier to get started, but it’s not been without its struggles.

Hugo has a ton of themes to choose from. Picking your theme first is pretty important, because it will dictate the structure of your repository. I found it easier to start with copying the example sites from the theme and customizing. I went with the Anatole theme as it was fairly simple and also had prominent links to social in the left hand bar. This site isn’t hosting anything other than these blog entries and links to my social profiles, so it fit well.

There’s a lot in flight with Hugo right now. I found I had to bounce around pretty significantly between sets of instructions. I did step 1 & 2 from the Hugo Quickstart, and then I followed in the structions on the Anatole getting started. After some trial and error, I found myself able to trim down the Example Site, remove the extra language support, create new posts, and work with them live in hugo server --bind 0.0.0.0 (my browser is running on a different machine than I develop on).

Building a Hugo site is pretty straightforward. Just run hugo. Then, you can host it with any static server. Here’s an example:

hugo
python3 -mhttp.server --directory public 8000

Next, we’re going to get the site running in a Docker container.

Posts in this Series