Resize image in news
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user