From ad3107622a44601c1baa92f6a51a94e52cc742f5 Mon Sep 17 00:00:00 2001 From: Simon C Date: Thu, 21 Oct 2021 22:25:55 +0200 Subject: [PATCH] feat: Add specific render to add lazy loading --- layouts/_default/_markup/render-image.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 layouts/_default/_markup/render-image.html diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..86a9c64 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,10 @@ +{{/* + 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 }} + {{ $resized := $image.Resize "610x q100 webp" }} + {{ $path = $resized.RelPermalink }} +{{ end }} +{{ .Text }}