janxyz
October 10, 2020, 11:55pm
1
I built this module which generates automatic srcsets for your Markdown images: https://github.com/jan-xyz/hugo-module-img-srcset
All you need to do to get source sets now is:
In your hugo project run
hugo mod get -u github.com/jan-xyz/hugo-module-img-srcset
and add the module to your config.toml
:
...
theme = [ "github.com/jan-xyz/hugo-module-img-srcset"]
...
I hope this helps someone I was looking for something like this for quite a while and was actually pointed by @bep into the correct direction today: https://github.com/gohugoio/hugo/issues/5034#issuecomment-706602779
8 Likes
bep
October 11, 2020, 11:02am
2
Nice.
In your installation instructions, the first step (hugo mod get -u) should not be needed. Adding it to your config.toml should be enough.
2 Likes
janxyz
October 12, 2020, 7:33pm
4
@bep thanks, I didn’t know that! I removed it from the README.
iaeiou
March 13, 2022, 4:23pm
5
A fix was just released: if you previously tested this module and couldn’t make it work, give it another try: a fix was released a few days ago.
Thanks @janxyz for this awesome module!
hi @janxyz
I already use a partial which generates multiple image sizes, convert jpg to webp and also serve the 2x images. Is using the module you create better then using a regular partial layout for image? if yes how?
thanks