From 92658f1b883c713fab2aa99ffea79140857c371e Mon Sep 17 00:00:00 2001 From: Wolf Noble Date: Tue, 5 Dec 2023 15:41:43 -0600 Subject: [PATCH 1/2] :sparkles: :lipstick: :recycle: :children_crossing: render author image with picture partial --- layouts/partials/author.html | 17 ++++++----------- layouts/partials/home/profile.html | 12 ++++-------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 84c6e9d9..a3a2aeb3 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,19 +1,14 @@ {{ if .Params.showAuthor | default (.Site.Params.article.showAuthor | default true) }} +{{- warnf "%s called. Author %s should be shown." .Page.File .Site.Language.Params.Author.name }}
+ {{ $lazy := .Params.enableImageLazyLoading|default .Site.Params.enableImageLazyLoading | default true }} + {{ $altText := ($.Site.Language.Params.Author.name | default "Author") }} {{ with .Site.Language.Params.Author.image }} + {{- warnf "called. AuthorImage %s should be shown." . }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} - {{ $authorImage := $authorImage.Fill "192x192 Center" }} - {{ $.Site.Language.Params.Author.name | default + {{ $imgClass := "!mb-0 !mt-0 me-4 w-24 h-auto rounded-full" }} + {{ partial "picture.html" (dict "img" $authorImage "alt" $altText "class" $imgClass "lazy" $lazy ) }} {{ end }} {{ end }}
diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index a9063d43..2c352288 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -4,17 +4,13 @@ {{ end }} flex flex-col items-center justify-center text-center" >
+ {{ $lazy := .Params.enableImageLazyLoading | default .Site.Params.enableImageLazyLoading | default true }} + {{ $altText := ($.Site.Language.Params.Author.name | default "Author") }} {{ with .Site.Language.Params.Author.image }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} - {{ $authorImage := $authorImage.Fill "288x288 Center" }} - {{ $.Site.Language.Params.Author.name | default + {{ $imgClass := "mb-2 h-auto w-36 rounded-full" }} + {{ partial "picture.html" (dict "img" $authorImage "alt" $altText "class" $imgClass "lazy" $lazy) }} {{ end }} {{ end }}

From a1a6d6f4683d4b5bf6fcf0effdd61ab47b61ea82 Mon Sep 17 00:00:00 2001 From: Wolf Noble <1680659+wolfspyre@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:06:39 -0600 Subject: [PATCH 2/2] Update author.html remove superfluous warning --- layouts/partials/author.html | 1 - 1 file changed, 1 deletion(-) diff --git a/layouts/partials/author.html b/layouts/partials/author.html index a3a2aeb3..9034020a 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -4,7 +4,6 @@ {{ $lazy := .Params.enableImageLazyLoading|default .Site.Params.enableImageLazyLoading | default true }} {{ $altText := ($.Site.Language.Params.Author.name | default "Author") }} {{ with .Site.Language.Params.Author.image }} - {{- warnf "called. AuthorImage %s should be shown." . }} {{ $authorImage := resources.Get . }} {{ if $authorImage }} {{ $imgClass := "!mb-0 !mt-0 me-4 w-24 h-auto rounded-full" }}