From 0f59b4376646511c9807901b754465f190f0f2e1 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 26 Dec 2021 22:46:12 +0000 Subject: [PATCH] Convert images to webp --- layouts/_default/_markup/render-image.html | 2 +- layouts/index.html | 2 +- layouts/partials/content.html | 2 +- layouts/partials/list_item.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 531aacc..77d06ea 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -3,7 +3,7 @@ {{ $resource := .Page.Resources.GetMatch $destination }} {{ if $resource }} - {{ $destination = ($resource.Resize "1500x").RelPermalink }} + {{ $destination = ($resource.Resize "1500x webp").RelPermalink }} {{ end }}
diff --git a/layouts/index.html b/layouts/index.html index afe7524..93c0548 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,6 @@ {{ define "main" }} -{{ $header_image := (resources.Get "img/header.jpg" | fingerprint).Resize "1500x" }} +{{ $header_image := (resources.Get "img/header.jpg" | fingerprint).Resize "1500x webp" }}

{{ .Site.Params.author_name }}

diff --git a/layouts/partials/content.html b/layouts/partials/content.html index a67e88a..3e6b4fa 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -2,7 +2,7 @@ {{ .Scratch.Set "image" .Params.image }} {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} - {{ .Scratch.Set "image" ($resource.Resize "2000x").RelPermalink }} + {{ .Scratch.Set "image" ($resource.Resize "2000x webp").RelPermalink }} {{ else if hasPrefix .Params.image "unsplash:" }} {{ $unsplash_id := replace .Params.image "unsplash:" "" }} {{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }} diff --git a/layouts/partials/list_item.html b/layouts/partials/list_item.html index 9d92b66..1d6f4da 100644 --- a/layouts/partials/list_item.html +++ b/layouts/partials/list_item.html @@ -5,7 +5,7 @@ {{ .Scratch.Set "image" .Params.image }} {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} - {{ .Scratch.Set "image" ($resource.Resize "500x").RelPermalink }} + {{ .Scratch.Set "image" ($resource.Resize "500x webp").RelPermalink }} {{ else if hasPrefix .Params.image "unsplash:" }} {{ $unsplash_id := replace .Params.image "unsplash:" "" }} {{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}