feat: Convertion des jpg en webp

This commit is contained in:
Simon 2021-05-03 14:57:56 +02:00
parent 9619c20b9b
commit 17a13a4430
4 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{{ $isBig := default false (.Scratch.Get "big") }} {{ $isBig := default false (.Scratch.Get "big") }}
{{ $title := .RenderString .Title }} {{ $title := .RenderString .Title }}
{{ $titleWithoutHTML := $title | plainify }} {{ $titleWithoutHTML := $title | plainify }}
{{ $pictureSize := cond $isBig "220x220 Center" "100x100 Center" }} {{ $pictureSize := cond $isBig "220x220 Center webp" "100x100 Center webp" }}
{{ $truncateSize := cond $isBig 180 90}} {{ $truncateSize := cond $isBig 180 90}}
<div class="post{{ if $isBig }} big{{ end }}"> <div class="post{{ if $isBig }} big{{ end }}">
<div class="picture"> <div class="picture">

View File

@ -3,7 +3,7 @@
<div class="container conseilmunicipal"> <div class="container conseilmunicipal">
{{ range sort $.Site.Data.conseilmunicipal.conseilmunicipal "nom" }} {{ range sort $.Site.Data.conseilmunicipal.conseilmunicipal "nom" }}
{{ $image := $headless.Resources.GetMatch .image }} {{ $image := $headless.Resources.GetMatch .image }}
{{ $resized := $image.Resize "250x" }} {{ $resized := $image.Resize "250x webp" }}
{{ partial "person.html" (merge . (dict "image" $resized.RelPermalink)) }} {{ partial "person.html" (merge . (dict "image" $resized.RelPermalink)) }}
{{ end }} {{ end }}
</div> </div>

View File

@ -1,6 +1,6 @@
{{ $isBig := (default .IsHome .Params.big) }} {{ $isBig := (default .IsHome .Params.big) }}
{{ $imageSizeSmall := cond $isBig "600x600 Top" "600x400 Center" }} {{ $imageSizeSmall := cond $isBig "600x600 Top webp" "600x400 Center webp" }}
{{ $imageSizeBig := cond $isBig "1920x850 Top" "1920x450 Center" }} {{ $imageSizeBig := cond $isBig "1920x850 Top webp" "1920x450 Center webp" }}
<header class="header{{ if $isBig }} home{{ end }}"> <header class="header{{ if $isBig }} home{{ end }}">
{{ $headless := .Site.GetPage "/" }} {{ $headless := .Site.GetPage "/" }}
{{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }} {{ $image := default ($headless.Resources.GetMatch "**.jpg") (.Resources.GetMatch (default "**.jpg" .Params.image)) }}

View File

@ -1,6 +1,6 @@
{{ $headless := .Site.GetPage "/viemunicipale/lemotdumaire" }} {{ $headless := .Site.GetPage "/viemunicipale/lemotdumaire" }}
<p class="maire"> <p class="maire">
{{ $image := $headless.Resources.GetMatch "maire.jpg" }} {{ $image := $headless.Resources.GetMatch "maire.jpg" }}
{{ $resized := $image.Resize "300x" }} {{ $resized := $image.Resize "300x webp" }}
<img class="round" src="{{ $resized.RelPermalink }}" alt="Didier PONCET" /> <img class="round" src="{{ $resized.RelPermalink }}" alt="Didier PONCET" />
</p> </p>