Convert all images to webp when possible

This commit is contained in:
2021-11-08 17:15:15 +01:00
parent 16f049dd09
commit 99c0d62efe
77 changed files with 33 additions and 56 deletions
@@ -0,0 +1,5 @@
{{- $img := resources.Get .path }}
{{- $img = $img.Resize (printf "%dx%d webp" $img.Width $img.Height) }}
<img src="{{ $img.Permalink }}" alt="{{ .alt | default " " }}" width="{{ .width | default $img.Width }}"
height="{{ .height | default $img.Height }}" {{- if .class}}class="{{ .class }}" {{end}}
{{- if .style}}style="{{ .style | safeCSS | default " " }}" {{end}} />
+1 -1
View File
@@ -2,7 +2,7 @@
style="text-decoration: none;">
<div class="logo">
{{- if .Site.Params.Logo.path }}
<img src="{{ .Site.Params.Logo.path }}" alt="{{ .Site.Params.Logo.alt }}" />
{{- partial "image.html" (dict "path" .Site.Params.Logo.path "alt" .Site.Params.Logo.alt) }}
{{- else }}
<span class="logo__mark">></span>
<span class="logo__text">{{- with .Site.Params.Logo.logoText }}{{ . }}{{ else }}$ cd /home/{{ end }}<span
@@ -16,8 +16,9 @@
content="{{ if .IsHome }}{{ .Site.Params.homeSubtitle }}{{ else }}{{ .Params.description | plainify }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{- with .Params.cover }}
<meta property="og:image" content="{{ . | absURL }}" />
{{- $img := imageConfig (printf "static/%s" .) }}
{{- $img := resources.Get . }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
<meta property="og:image" content="{{ $img.Permalink }}" />
<meta property="og:image:width" content="{{ $img.Width }}" />
<meta property="og:image:height" content="{{ $img.Height }}" />
{{- end }}
@@ -49,7 +50,9 @@
<!-- Twitter cards -->
<meta name="twitter:card" content="summary_large_image" />
{{- if .Params.cover }}
<meta name="twitter:image" content="{{ .Params.cover | absURL }}" />
{{- $img := resources.Get .Params.cover }}
{{- $img = $img.Resize (printf "%dx%d png" $img.Width $img.Height) }}
<meta name="twitter:image" content="{{ $img.Permalink }}" />
<meta name="twitter:image:alt" content="{{ .Params.title | plainify | default " " }}" />
{{- end }}
<meta name="twitter:title" content="{{ .Title }}" />