diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 7a5a89a..657f8d1 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,11 +1,15 @@ + {{/* S'il n'y a pas de / dans l'url d'une image alors on ajoute le path de l'article */}} {{ $path := cond (in .Destination "/") .Destination (path.Join "/" .Page.File.Dir .Destination) }} {{ $image := .Page.Resources.GetMatch (printf "*%s*" .Destination) }} {{ with $image }} - {{ $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 }} + {{ $maxWidth := (default "610" site.Params.ImageWidth) }} + {{ if gt $image.Width $maxWidth }} + {{ $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 }} + {{ end }} {{ end }} {{ .Text }}