Resize image in news

This commit is contained in:
2026-01-01 17:29:22 +01:00
parent 8ad7d1f991
commit 017c7a2b88

View File

@@ -9,7 +9,17 @@
{{ if not $resource }}
{{ $resource = resources.GetMatch $filename }}
{{ end }}
{{ if (and (ne (.Get "width") "") (ne (.Get "height") "") ) }}
{{/* warnf "%#v %#v %s" (.Get "width") (.Get "height") .Position */}}
{{/* warnf "Both width and height are set for %s" .Page */}}
{{ $sizing := printf "%sx%s webp" (.Get "width") (.Get "height") }}
{{/* warnf "%s, %s, %s" $sizing .Position $resource */}}
{{ with ($resource.Fit $sizing) }}
{{ $resource = . }}
{{ end }}
{{ end }}
src="{{ $resource.Permalink }}"
style="{{- with .Get "height" -}}max-height: {{.}}px;{{- end -}}"
>
{{ with .Get "href" }}
</a>