The disableImageOptimization setting now affects author images.

This commit is contained in:
MaikelChan 2023-07-30 20:42:45 +02:00
parent 2c3cbeb0ae
commit a6263505f8
No known key found for this signature in database
GPG key ID: B2CE398C279239EC
5 changed files with 20 additions and 5 deletions

View file

@ -1,8 +1,11 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<div class="flex mt-4"> <div class="flex mt-4">
{{ with .data.image }} {{ with .data.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192" }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "192x192" }}
{{ end }}
<img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96" <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96"
src="{{ $authorImage.RelPermalink }}" /> src="{{ $authorImage.RelPermalink }}" />
{{ end }} {{ end }}

View file

@ -1,8 +1,11 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<div class="flex"> <div class="flex">
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "192x192" }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "192x192" }}
{{ end }}
<img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96" <img class="!mt-0 !mb-0 h-24 w-24 rounded-full ltr:mr-4 rtl:ml-4" width="96" height="96"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{ end }} {{ end }}

View file

@ -1,3 +1,4 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<article class="max-w-full prose dark:prose-invert"> <article class="max-w-full prose dark:prose-invert">
<div class="relative"> <div class="relative">
<div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div> <div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div>
@ -21,7 +22,9 @@
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288" }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img class="mb-2 rounded-full h-36 w-36" width="144" height="144" <img class="mb-2 rounded-full h-36 w-36" width="144" height="144"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{ end }} {{ end }}

View file

@ -1,3 +1,4 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<article class="max-w-full prose dark:prose-invert"> <article class="max-w-full prose dark:prose-invert">
<div class="relative"> <div class="relative">
<div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div> <div class="absolute inset-x-0 bottom-0 h-1/2 bg-gray-100"></div>
@ -18,7 +19,9 @@
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288" }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img class="mb-2 rounded-full h-36 w-36" width="144" height="144" <img class="mb-2 rounded-full h-36 w-36" width="144" height="144"
alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" /> alt="{{ $.Site.Author.name | default " Author" }}" src="{{ $authorImage.RelPermalink }}" />
{{ end }} {{ end }}

View file

@ -1,3 +1,4 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<article <article
class="{{ if not .Site.Params.homepage.showRecent }} class="{{ if not .Site.Params.homepage.showRecent }}
h-full h-full
@ -7,7 +8,9 @@
{{ with .Site.Author.image }} {{ with .Site.Author.image }}
{{ $authorImage := resources.Get . }} {{ $authorImage := resources.Get . }}
{{ if $authorImage }} {{ if $authorImage }}
{{ $authorImage := $authorImage.Fill "288x288" }} {{ if not $disableImageOptimization }}
{{ $authorImage = $authorImage.Fill "288x288" }}
{{ end }}
<img <img
class="mb-2 rounded-full h-36 w-36" class="mb-2 rounded-full h-36 w-36"
width="144" width="144"