1
Files
2025/themes/2026/layouts/_partials/media/display-img.html

37 lines
1.1 KiB
HTML

{{- $image := .image -}}
{{- $showMeta := .showMeta -}}
{{- $forceCentered := .forceCentered -}}
{{- $alt := .alt -}}
{{- $title := .title -}}
{{- $display := $image -}}
{{- if ne $image.MediaType.SubType "svg" -}}
{{- if gt $image.Width $image.Height -}}
{{- $maxWidth := 1400 -}}
{{- if and $showMeta (not $forceCentered) -}}
{{- $maxWidth = 900 -}}
{{- end -}}
{{- $targetWidth := $image.Width -}}
{{- if gt $image.Width $maxWidth -}}
{{- $targetWidth = $maxWidth -}}
{{- end -}}
{{- $display = partial "media/process-image.html" (dict
"image" $image
"action" "Resize"
"spec" (printf "%dx" $targetWidth)
) -}}
{{- else -}}
{{- $targetHeight := $image.Height -}}
{{- if gt $image.Height 900 -}}
{{- $targetHeight = 900 -}}
{{- end -}}
{{- $display = partial "media/process-image.html" (dict
"image" $image
"action" "Resize"
"spec" (printf "x%d" $targetHeight)
) -}}
{{- end -}}
{{- end -}}
<img src="{{ $display.RelPermalink }}" alt="{{ $alt }}" title="{{ $title }}">