Files
hugo-theme-stack/layouts/_markup/render-image.html
T

19 lines
703 B
HTML
Raw Normal View History

2026-01-30 15:07:14 +01:00
{{- $image := partial "helper/image" (dict "Resources" .Page.Resources "Image" .Destination) -}}
{{- $alt := .PlainText | safeHTML -}}
{{/* SVG and external images won't work with gallery layout, because their width and height attributes are unknown */}}
2026-01-30 15:07:14 +01:00
{{- $galleryImage := and $image.Height $image.Width -}}
2026-01-30 15:07:14 +01:00
<img src="{{ $image.Permalink }}"
{{ with $image.Width }}width="{{ . }}"{{ end }}
{{ with $image.Height }}height="{{ . }}"{{ end }}
2022-02-06 19:58:10 +01:00
loading="lazy"
{{ with $alt }}
alt="{{ . }}"
{{ end }}
{{ if $galleryImage }}
class="gallery-image"
2022-02-06 19:58:10 +01:00
data-flex-grow="{{ div (mul $image.Width 100) $image.Height }}"
data-flex-basis="{{ div (mul $image.Width 240) $image.Height }}px"
{{ end }}
2022-02-06 19:58:10 +01:00
>