Don’t confuse gohugo by adding symlinks


I was wondering why Hugo could generate on my FreeBSD cloud VM, but not locally. I ran a plain hugo command:

$ hugo
==> Error: Cannot walk regular file

Could this just be it? If so, it’s one of the most routine mistakes one can make on a *nix system.

Earlier in the week I’d created a symlink to the layouts directory of my current theme, to save some typing.

$ ln -s ./themes/rubenerd-rubi/layouts ./layouts

Even though Hugo’s config.yaml was specifically set to use that theme, it still attempted to load that folder as well. I’ve since learned this is expected, and in fact desired behavior: you may want to override a theme with a local site file.

(Yes, I use YAML. I couldn’t grok TOML).

So lesson learned, don’t try and get clever.

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!