Hey there, new user here. I’m trying to add footnote references to image captions, in order to properly source them. After looking online a bunch I ended with this shortcode:
{{ $image := $.Page.Resources.GetMatch (.Get "src")}}
{{ $smallImage := $image.Resize "320x"}}
<figure class="figure-image">
<a href="{{ $image.RelPermalink }}">
<img src="{{$smallImage.RelPermalink }}"
{{- if .Get "alt" }}
alt="{{ with .Get "alt" }}{{ . }}{{ end }}"
{{- end -}}
/><!-- Closing img tag -->
</a>
<figcaption>
{{ .Inner }}
</figcaption>
</figure>
This works, but it necessitates enabling unsafe=true in [markup.goldmark.renderer], which seems like bad practice for something seemingly so simple. Also, if possible, I’d like to have footnotes work whilst using the typical markdown image code – i.e. – and changing render-image.html, but I didn’t manage to make this work (or even using the figure shortcode that comes bundled with Hugo). Is there another way to make this work that I’m missing? Using Markdownify doesn’t seem to make footnotes work, maybe because it doesn’t have access to the rest of the document? Any help would be more than welcome.