1
Fork 0

Convert images to webp

This commit is contained in:
Jake Howard 2021-12-26 22:46:12 +00:00
parent c4fec2ebac
commit 0f59b43766
Signed by: jake
GPG key ID: 57AFB45680EDD477
4 changed files with 4 additions and 4 deletions

View file

@ -3,7 +3,7 @@
{{ $resource := .Page.Resources.GetMatch $destination }}
{{ if $resource }}
{{ $destination = ($resource.Resize "1500x").RelPermalink }}
{{ $destination = ($resource.Resize "1500x webp").RelPermalink }}
{{ end }}
<figure class="text-center">

View file

@ -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" }}
<header id="index-header" class="d-flex align-items-center" style="background-image: url({{ $header_image.RelPermalink }})">
<div class="text-center m-auto text-light">
<h1 class="display-1">{{ .Site.Params.author_name }}</h1>

View file

@ -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") }}

View file

@ -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") }}