2021-08-11 05:28:33 +00:00
|
|
|
{{ if .Get "src" }}
|
|
|
|
{{ $image := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
|
|
|
|
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
2022-01-12 03:21:22 +00:00
|
|
|
{{- if .Get "href" -}}
|
|
|
|
<a href="{{ .Get "href" }}">
|
|
|
|
{{- end -}}
|
|
|
|
<img src="{{ $image.RelPermalink }}"
|
|
|
|
{{- if or (.Get "alt") (.Get "caption") }}
|
|
|
|
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
|
2021-08-11 05:28:33 +00:00
|
|
|
{{- end -}}
|
2023-05-26 21:26:57 +00:00
|
|
|
loading="lazy"
|
2022-01-12 03:21:22 +00:00
|
|
|
width="100%"
|
|
|
|
height="auto"
|
|
|
|
style="max-width:{{ div $image.Width 2 }}px; max-height:{{ div $image.Height 2 }}px;"
|
|
|
|
/>
|
|
|
|
{{- if .Get "href" }}</a>{{ end -}}
|
|
|
|
{{- if .Get "caption" -}}
|
|
|
|
<figcaption>
|
|
|
|
{{- .Get "caption" | markdownify -}}
|
|
|
|
</figcaption>
|
|
|
|
{{- end }}
|
2021-08-11 05:28:33 +00:00
|
|
|
</figure>
|
|
|
|
{{ end }}
|