From 751856fcc2707ab14a6d65c6d8058aaae70a0601 Mon Sep 17 00:00:00 2001
From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com>
Date: Sat, 4 Oct 2025 01:05:46 +0800
Subject: [PATCH] fix: show full size author image when zooming
---
layouts/partials/author-extra.html | 6 ++++--
layouts/partials/author.html | 12 ++++++++----
layouts/partials/home/background.html | 8 +++++---
layouts/partials/home/hero.html | 10 ++++++----
layouts/partials/home/profile.html | 10 ++++++----
5 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/layouts/partials/author-extra.html b/layouts/partials/author-extra.html
index fd18a385..de97e797 100644
--- a/layouts/partials/author-extra.html
+++ b/layouts/partials/author-extra.html
@@ -8,14 +8,16 @@
{{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }}
+ {{ $final := $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "192x192" }}
+ {{ $final = $authorImage.Fill "192x192" }}
{{ end }}
+ src="{{ $final.RelPermalink }}"
+ data-zoom-src="{{ $authorImage.RelPermalink }}">
{{ end }}
{{ end }}
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
index 50d2f54c..57d8088c 100644
--- a/layouts/partials/author.html
+++ b/layouts/partials/author.html
@@ -8,26 +8,30 @@
{{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }}
+ {{ $final := $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "192x192" }}
+ {{ $final = $authorImage.Fill "192x192" }}
{{ end }}

+ src="{{ $final.RelPermalink }}"
+ data-zoom-src="{{ $authorImage.RelPermalink }}">
{{ else }}
{{ $authorImage := resources.GetRemote . }}
+ {{ $final := $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill "192x192" }}
+ {{ $final = $authorImage.Fill "192x192" }}
{{ end }}

+ src="{{ $authorImage.RelPermalink }}"
+ data-zoom-src="{{ $authorImage.RelPermalink }}">
{{ end }}
{{ end }}
diff --git a/layouts/partials/home/background.html b/layouts/partials/home/background.html
index b0090d12..e425de9a 100644
--- a/layouts/partials/home/background.html
+++ b/layouts/partials/home/background.html
@@ -41,15 +41,17 @@
{{ $authorImage = resources.Get . }}
{{ end }}
{{ if $authorImage }}
+ {{ $final := $authorImage }}
{{ if not $disableImageOptimization }}
- {{ $authorImage = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
+ {{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }}
{{ end }}

+ alt="{{ $.Site.Params.Author.name | default `Author` }}"
+ src="{{ $final.RelPermalink }}"
+ data-zoom-src="{{ $authorImage.RelPermalink }}">
{{ end }}
{{ end }}