initialisation du site
This commit is contained in:
11
layouts/_default/_markup/render-image.html
Normal file
11
layouts/_default/_markup/render-image.html
Normal file
@ -0,0 +1,11 @@
|
||||
{{/*
|
||||
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 }}
|
||||
{{ $width := cond (gt .Width 960) 960 .Width }}
|
||||
{{ $resized := $image.Resize (printf "%sx q100 webp" (string $width)) }}
|
||||
{{ $path = $resized.RelPermalink }}
|
||||
{{ end }}
|
||||
<img src="{{ $path | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} loading="lazy" />
|
Reference in New Issue
Block a user