my journey to Hugo - continued

Tue, May 26, 2020 1-minute read

I’ve managed to get one core-concept of Hugo completely wrong when I first migrated my blog from Wordpress to Hugo. In my last blog post, “tweak the theme to fit your needs” I suggested to modify theme files directly - DON’T DO THAT!.

Thanks @Paul for letting me know!

Hugo has a concept of inheritance among files between themes and your websites static/ elements.

This breaks down to:

  • If you want to modify some part of a theme, simply copy the themes file into your static/ folder and change it there - it’ll override the templates file!
  • I should really slow down and read the docs first 😀

See Customizing a Theme.

The following are key concepts for Hugo site customization. Hugo permits you to supplement or override any theme template or static file, with files in your working directory.

So instead of changeing style.css inside the templates static/css folder, simply create a css folder in your root and place your very own style.css file there.

The same works for shortcodes and basically everything else - you can even decide to upgrade jQuery to a newer version as shipped with your chosen Hugo theme, etc. etc..