31 lines
941 B
HTML
31 lines
941 B
HTML
|
|
{{- $image := .resource -}}
|
||
|
|
|
||
|
|
{{-
|
||
|
|
$resizedImages := dict
|
||
|
|
"full" ($image.Fit "2560x2560")
|
||
|
|
"half" ($image.Fit "1280x1280")
|
||
|
|
"quarter" ($image.Fit "640x640")
|
||
|
|
-}}
|
||
|
|
|
||
|
|
<figure class="figure figure--image
|
||
|
|
{{- if eq .size "main" }}figure--main-column{{ end }}">
|
||
|
|
{{ if .linksToFullSizeImage -}}
|
||
|
|
<a href="{{ $image.RelPermalink }}">
|
||
|
|
{{- end -}}
|
||
|
|
<img
|
||
|
|
src="{{ (index $resizedImages "full").RelPermalink }}"
|
||
|
|
srcset="
|
||
|
|
{{ (index $resizedImages "full").RelPermalink }} 2560w,
|
||
|
|
{{ (index $resizedImages "half").RelPermalink }} 1280w,
|
||
|
|
{{ (index $resizedImages "quarter").RelPermalink }} 640w,
|
||
|
|
"
|
||
|
|
{{ with $image.Params.alt | default $image.Title }} alt="{{ . }}"{{ end }}
|
||
|
|
{{ with $image.Title }} title="{{ . }}"{{ end }}>
|
||
|
|
{{ if .linksToFullSizeImage -}}
|
||
|
|
</a>
|
||
|
|
{{- end -}}
|
||
|
|
{{ if .shouldShowTitle }}
|
||
|
|
{{ partial "page/figures/caption.html" . }}
|
||
|
|
{{ end }}
|
||
|
|
</figure>
|