Link render hook is the only one without attributes

I don’t see why they’re not useful for links.

I don’t understand.
https://gohugo.io/render-hooks/code-blocks/#attributes

Sorry, this post went through a bit of rewriting, and I messed up. I fixed the title.

We can apply Markdown attributes to some block elements, but not to inline elements such as links. An exception to this is images without adjacent content, provided you enable the wrapStandAloneImageWithinParagraph setting.

If you need to pass something to a link render hook, you might use the query string in conjunction with urls.Parse, e.g.,

[Download this PDF](/docs/registration-form.pdf?download=true)

That’s also a powerful approach with an image render hook, where you can pass the image processing spec in the query string, e.g.,

![a kitten](kitten.jpg?w=300&method=resize&format=webp)
3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.