For bloggers that use the Markdown syntax for images, Hugo’s render hooks are pretty cool.
You get complete control over how to render the img
tag. So, for example, Micro.blog could have a default that uses the image cache for large photos, sets width
and height
correctly, and maybe sets loading
to lazy
(which will defer downloading of images until they are shown in view).
Power users can override the default and render images their way. For example, maybe they want all images to be zoomable or render images differently depending on the post type.
Unfortunately, render hooks only works with “Markdown images” (
). So people who use HTML to insert images in their blog posts are out of luck. Of course, this could also be handled during the build process. Some kind of post processing on the rendered HTML before it’s deployed, but I don’t think there’s built-in support for that in Hugo.