1

Optimisation des images++

This commit is contained in:
2026-03-06 00:16:17 +01:00
parent 1a341d428e
commit d7064aacbb
7 changed files with 11 additions and 9 deletions

View File

@@ -100,7 +100,7 @@
{{- $title := default (printf "Image complémentaire : %s" $imageName) (index $data "title") -}}
{{- $thumbnail := . -}}
{{- if and (ne .MediaType.SubType "svg") (gt .Width 360) -}}
{{- $thumbnail = .Resize "360x" -}}
{{- $thumbnail = .Resize "360x webp q80" -}}
{{- end -}}
<li>
<a href="{{ .RelPermalink }}" title="{{ $title }}">

View File

@@ -41,6 +41,8 @@
{{- $thumbnailTransform = "900x506" -}}
{{- end -}}
{{- $thumbnailOptions := printf "%s webp q80" $thumbnailTransform -}}
{{- $coverPath := $page.Params.cover -}}
{{- $image := false -}}
{{- if $coverPath -}}
@@ -109,7 +111,7 @@
<a href="{{ $page.RelPermalink }}">
<figure>
{{- with $image -}}
{{- $resized := .Fill $thumbnailTransform -}}
{{- $resized := .Fill $thumbnailOptions -}}
<img src="{{ $resized.RelPermalink }}" alt="Image de couverture pour {{ $page.Title }}" loading="lazy">
{{- end -}}
</figure>
@@ -125,7 +127,7 @@
<a href="{{ $page.RelPermalink }}">
<figure>
{{- with $image -}}
{{- $resized := .Fill $thumbnailTransform -}}
{{- $resized := .Fill $thumbnailOptions -}}
<img src="{{ $resized.RelPermalink }}" alt="Image de couverture pour {{ $page.Title }}" loading="lazy">
{{- end -}}
</figure>

View File

@@ -4,7 +4,7 @@
{{- $assetPath := "images/oeuvres/l-anankeisme.png" -}}
{{- $source := resources.Get $assetPath -}}
{{- if $source -}}
{{- $img := $source.Resize "320x" -}}
{{- $img := $source.Resize "320x webp q80" -}}
<img src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}" alt="Couverture de L'Anankéisme" loading="lazy">
{{- end -}}
</figure>

View File

@@ -4,7 +4,7 @@
{{- $assetPath := "images/oeuvres/l-humain-cette-espece-primitive.jpeg" -}}
{{- $source := resources.Get $assetPath -}}
{{- if $source -}}
{{- $img := $source.Resize "320x" -}}
{{- $img := $source.Resize "320x webp q80" -}}
<img src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}" alt="Couverture de L'Humain, cette espèce primitive" loading="lazy">
{{- end -}}
</figure>

View File

@@ -6,7 +6,7 @@
{{- $logo := resources.GetMatch $logoPath -}}
<a href="{{ "/" | relURL }}" aria-label="Revenir à l'accueil">
{{- with $logo -}}
{{- $resized := .Resize "64x" -}}
{{- $resized := .Resize "64x webp q80" -}}
<img src="{{ $resized.RelPermalink }}" alt="">
{{- end -}}
<strong>{{ $site.Title }}</strong>

View File

@@ -36,7 +36,7 @@
{{- with $image -}}
<a href="{{ $page.RelPermalink }}">
<figure>
{{- $resized := .Fill "600x340" -}}
{{- $resized := .Fill "600x340 webp q80" -}}
<img src="{{ $resized.RelPermalink }}" alt="Image de couverture pour {{ $page.Title }}" loading="lazy">
</figure>
</a>

View File

@@ -305,7 +305,7 @@
<a href="{{ $page.RelPermalink }}">
<figure>
{{- with $image -}}
{{- $resized := .Fill "166x91" -}}
{{- $resized := .Fill "166x91 webp q80" -}}
<img src="{{ $resized.RelPermalink }}" alt="Capture du lien {{ $page.Title }}" loading="lazy">
{{- end -}}
</figure>
@@ -391,7 +391,7 @@
<a href="{{ $item.RelPermalink }}" title="{{ $item.Title }}">
<figure>
{{- with $itemImage -}}
{{- $resized := .Resize "x128" -}}
{{- $resized := .Resize "x128 webp q80" -}}
<img src="{{ $resized.RelPermalink }}" alt="{{ $item.Title }}" title="{{ $item.Title }}" loading="lazy">
{{- end -}}
</figure>