2021-10-21 22:25:55 +02:00
|
|
|
{{/*
|
|
|
|
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 }}
|
2022-02-01 12:12:02 +01:00
|
|
|
{{ $resizeParams := delimit (slice (default "610x" site.Params.ImageSize) (default "q100" site.Params.ImageQuality) (default "webp" site.Params.ImageFormat)) " " }}
|
|
|
|
{{ $resized := $image.Resize (string $resizeParams) }}
|
2021-10-21 22:25:55 +02:00
|
|
|
{{ $path = $resized.RelPermalink }}
|
|
|
|
{{ end }}
|
|
|
|
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />
|