Support for attributes is limited to headings and block elements (including code blocks). Images and links are inline elements.
https://gohugo.io/getting-started/configuration-markup#goldmark
attribute
Enable custom attribute support for titles and blocks by adding attribute lists inside single curly brackets (
{.myclass class="class1 class2" }
) and placing it after the Markdown element it decorates , on the same line for titles and on a new line directly below for blocks.
I’m not sure where you saw this, but it doesn’t do anything:
[markup.goldmark.parser.attribute]
image = true
Common approaches:
- Create a shortcode
- Use an image render hook and pass the params as a destination query string
- Use an image render hook and pass the params in the image title attribute
Related:
https://discourse.gohugo.io/t/is-it-possible-to-use-attribute-lists-with-render-hooks/31374