I would like to integrate the new Dither filter to make all the images on my website dithered. I don’t quite know how to make filters and such work inside of a render hook, how would I go about that?
The snippet above works for me, but instead of printing the caption given in the markdown file, it prints the relative image path. Also, if I try to add alt text with alt={{ .Text }} I get a “can’t evaluate field Text in type images.ImageResource” error.
{{ $imgTitle := .Title }}
{{ with .Page.Resources.Get .Destination }}
{{ with . | images.Filter images.Dither }}
<img src="{{ .RelPermalink }}">
{{ $imgTitle }}
{{ end }}
{{ end }}
You can save the .Title or any other attributes provided by image render hook in a variable and then use it in the with loop. This way you can access render-hook variable inside the loop.