Hugo is an awesome page generator which I use for many of my websites. I like the fact that all I need to write is a simple
*.md file and everything is rendered locally on my machine and pushed as a static page to the web.
The good people working on Hugo, obviously try to improve the software with every release and at times they introduced breaking changes. For me as a blog author that means I have to carefully analyze every change they make and if I use a new version I have to make sure the template-rendering works without issues.
To avoid that extra work I decided to stick with Hugo 0.49. It is compatible with my selected themes and all my
*.md files look as they should. In the past I was able to convince my package manager (homebrew) to install Hugo 0.49 on my machine using this trick by Flavio Copes. However, recently I switched to Apple’s ARM platform and I wasn’t able to install the old version using homebrew.
Luckily I found a new approach. The solution is a Docker created by klakegg (GitHub). With this two commands I was able to build my pages again:
docker run --rm -it -v $(pwd):/src -p 1315:1313 klakegg/hugo:0.49 server -D
docker run --rm -it -v $(pwd):/src -v $(pwd)/public:/target klakegg/hugo:0.49
Docker automatically discovered that it had to run the image in
linux/amd64 compatibility mode and it worked without bigger issues. The rendering performance is still great and thanks to the mounted local directory I don’t need to change my workflow.
The only two things I noticed is that auto reloading on change doesn’t work anymore and that I cannot stop the running docker by pressing
CTRL + C in the terminal. A small price for not having to check all my text pages over and over again.
A brilliant thing! Thank you klakegg!