It’s the year 2020, and I’m finally replacing my placeholder website with something a bit more substantial. I’ve long put this off, in part because I couldn’t decide on a technology. Should I try to roll my own with something like Python & Django or web.py? Should I just install Wordpress like it seems nearly everyone else does?

My needs are not that complicated. I don’t plan on having user comments or anything else that’s interactive. I don’t really care about user analytics or even tracking the number of page views I have. I’m perfectly happy hand-editing content files in Markdown and indeed I’d prefer that to GUI tools or hand-editing HTML. Really all I need is something to generate a bunch of HTML so that I can just publish it to my webserver.

Indeed, there are some serious advantages to doing just that:

  • Much faster page loads. There’s no need to wait for some process to start, call a database, put together an HTML file and serve it to the user when every page response for a URL is going to be the exact same and simply isn’t going to be updated all that often.
  • Much more easily cached. It’s not that important to this application (Who’s reading this blog anyways?), but in cases where there are millions of users, this approach makes things CDNs much more effective at scale.
  • A much smaller attack surface. There’s no web admin interface to spam passwords at, and there’s not as many thing to try to manipulate in the hopes getting access to something they shouldn’t have. One can’t do an SQL injection on a database server that isn’t running or isn’t exposed to the web at all.
  • Lower server resource consumption. This is perhaps a bit more relevant to me than a lot of other users, since I’ve got quite a low end VPS hosting this.

There are lots of tools that do this sort of static website generation. For now, I’ve decided to use Hugo, a static site generator written in Golang. I’m generating this blog post right here by writing Markdown in VIM and having Hugo turn it into HTML.

So far I’ve enjoyed the experience of setting this up. Hugo comes with a development server that automatically triggers my browser to reload the page every time I edit some of the files inside. Who needs a WISIG when seeing the results of your writing in a browser is just a :w away?

There are a few reasons why one wouldn’t want to do static gen, and why one wouldn’t want to use Hugo specifically. If you’re doing things that are user driven such as a comment section, static generation starts to get a lot harder and you lose many of the benefits of doing it. And if you prefer a web-based means of updating a blog or website, there are other static site generation programs that are better suited to that kind of workflow out there. But for my needs, I’m liking what I’m seeing so far.