feat: Add new parameters on hugo to fix resize image
This commit is contained in:
parent
2b026a00ab
commit
ae3473dcea
|
@ -4,7 +4,8 @@
|
||||||
{{ $path := cond (in .Destination "/") .Destination (path.Join "/" .Page.File.Dir .Destination) }}
|
{{ $path := cond (in .Destination "/") .Destination (path.Join "/" .Page.File.Dir .Destination) }}
|
||||||
{{ $image := .Page.Resources.GetMatch (printf "*%s*" .Destination) }}
|
{{ $image := .Page.Resources.GetMatch (printf "*%s*" .Destination) }}
|
||||||
{{ with $image }}
|
{{ with $image }}
|
||||||
{{ $resized := $image.Resize "610x q100 webp" }}
|
{{ $resizeParams := delimit (slice (default "610x" site.Params.ImageSize) (default "q100" site.Params.ImageQuality) (default "webp" site.Params.ImageFormat)) " " }}
|
||||||
|
{{ $resized := $image.Resize (string $resizeParams) }}
|
||||||
{{ $path = $resized.RelPermalink }}
|
{{ $path = $resized.RelPermalink }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />
|
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />
|
||||||
|
|
Loading…
Reference in New Issue