Schemescape

Development log of a life-long coder

Test-driving Hugo for a simple dev blog

I'm testing out the most promising static site generators to see which is closest to my ideal setup. First up is Hugo.

Hugo

First up is Hugo since it's the easiest to install and (according to Jamstack) is one of the top 3 most loved static site generators.

Installation

Installation is just downloading a binary. Great!

Setup

Going through their quick start guide, I use hugo new site quickstart to create Hugo's desired directory structure. It's a bit more convoluted than I expected (what is archetypes for?). Interesting.

Concepts

Hugo seems powerful, but, as we all know, power corrupts introduces complexity. This is my best understanding of Hugo's concepts (which map to directories):

Templates/theme

The next step is to add a theme. Huh, I thought I'd just plop in some HTML with curly brackets and build my own site. In the past, every theme I've used with a static site generator has been fairly bloated (even so-called "minimal" themes).

I'll eventually try and use my hand-crafted, minimal semantic HTML, but I suppose I can start with their suggested initial theme, "Ananke". It looks like themes mainly exist to allow reuse by other people, so I could perhaps even get away without a theme (using layouts exclusively).

First run

The directory structure is pretty close to what I already had, so I was already to launch the Hugo server:

hugo.exe server -D
Start building sites … 
...
Error: Error building site: TOCSS: failed to transform "ananke/css/main.css" (text/css). Check your Hugo installation; you need the extended version to build SCSS/SASS.
Built in 213 ms

Well, that's not encouraging. Apparently there's an extended version that I glossed over and is quietly required for their quick start. I do wonder why there's a separate build when the difference in size is only 8%. Maybe it's bundling other non-Go executables that aren't available everywhere?

With extended Hugo, the site served up fine and the default theme initially looked adequate, but it had a lot of junk I didn't want. Observations:

I guess I was right to be wary of default themes.

A few additional Hugo-related notes:

Using a custom theme

Hugo's documentation was surprisingly unhelpful when it comes to creating a theme from scratch. At least Hugo is popular enough that I was able to find a blog article about creating a Hugo theme from scratch.

My first reaction is that Hugo's template language is bizarre. I thought I'd just be writing code with Go syntax, but instead I'm seeing examples like this:

{{ if (isset .Params "description") }}
    {{ index .Params "description" }}
{{ else }}
    {{ .Summary }}
{{ end }}

Learning a new language that looks nothing like the languages I'm used to is not something I wanted to have to do for my simple site. Additionally, Hugo's lookup rules are much more complicated than I expected. I'm still not sure if files like layouts/_default/baseof.html are hard-coded names or if there's logic somewhere I could simplify in the configuration.

Additional notes:

Let's stop there for now

Although install was simple and the server worked, at this point, I'm not interested in learning Hugo's unintuitive template language. I honestly found XSL to be more intuitive (and that is not a compliment).

For posterity, I saved my terribly incomplete theme here:

https://github.com/jaredkrinke/hugo-bare-minimum

Let's hope the next static site generator I try is more my style!