I’m currently trying to improve the loading speed of my Hugo website Grammle and just tried converting PNG images to WebP (because everyone always says WebP is much smaller than PNG).
I started with this “Get it on Codeberg” image. (The page is in German but you’ll recognise the image.)
However, Hugo does not convert the PNG image to WebP at all. Why is that and how can I fix it?
When replacing webp with jpg the image is in fact converted to JPG though, so the issue is not that the conversion wouldn’t work at all, it just doesn’t work for WebP.
Oh, I didn’t realise I’m that far behind the latest release.
However, I just ran sudo apt-get update and sudo apt-get upgrade but this didn’t update Hugo at all.
Running sudo apt-get install hugo returned: hugo is already the newest version (0.68.3-1), so I completely uninstalled and re-installed Hugo but I still only got v0.68.3 again.
That’s why I just re-installed hugo with snap install hugo which got me v0.96.0, and running snap run hugo did in fact convert the PNG to WebP!
Just an added tip, re: Hugo version. The latest release as of this post is v0.101.0.
Since you’re using sudo/snap … if you want the latest release you can download the appropriate .deb file from: Releases · gohugoio/hugo · GitHub
Then just do: sudo apt install ./hugo_extended_0.1xx.x_Linux-64bit.deb
To be informed if there’s a new release, you can “Watch” the Github repo and have GH email you for updates.
As you can see, even Ubuntu’s snap is late.
It’s a little bit of a hassle doing it manually but at least you’ll always be at the latest release. Another added benefit, you can choose which version you want to stick at, you don’t necessarily have to update. Also you won’t get surprised if something stopped working because the OS auto-updated to a version with a deprecated/changed function (rare but might happen).