Use page resources in figure shortcode (and hash the images)

This commit is contained in:
BBaoVanC 2021-10-19 13:12:38 -05:00
parent b51c6c257f
commit 61ac27bdf9
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A

View File

@ -1,13 +1,15 @@
<figure>
{{ $img := $.Page.Resources.GetMatch (.Get "resrc") | resources.Fingerprint "sha512" }}
{{ if .Get "href" }}<a href="{{ .Get "href" }}">{{ end }}
<img src="{{ .Get "src" }}"
<img src="{{ $img.Permalink }}"
{{ if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}
{{ . }}
{{ else }}
{{ .Get "caption" | markdownify }}
{{ end }}"
alt="{{ with .Get "alt" -}}
{{ . -}}
{{ else -}}
{{ .Get "caption" | markdownify -}}
{{ end -}}"
{{ end }}
{{ with .Get "width" }} width="{{ . }}" {{ end }}