From afa810841cb9176bad41eb58a3401db0d38d56e4 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:46:53 +0800 Subject: [PATCH] feat(author): support svg image --- layouts/partials/author-extra.html | 2 +- layouts/partials/author.html | 2 +- layouts/partials/home/background.html | 2 +- layouts/partials/home/hero.html | 2 +- layouts/partials/home/profile.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/layouts/partials/author-extra.html b/layouts/partials/author-extra.html index 508383a5..2823977d 100644 --- a/layouts/partials/author-extra.html +++ b/layouts/partials/author-extra.html @@ -10,7 +10,7 @@ {{ if $authorImage }} {{ $final := $authorImage }} {{ $squareImage := $authorImage }} - {{ if not $disableImageOptimization }} + {{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }} {{ $final = $authorImage.Fill "192x192" }} {{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }} {{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }} diff --git a/layouts/partials/author.html b/layouts/partials/author.html index ab0fe327..995467e7 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -10,7 +10,7 @@ {{ if $authorImage }} {{ $final := $authorImage }} {{ $squareImage := $authorImage }} - {{ if not $disableImageOptimization }} + {{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }} {{ $final = $authorImage.Fill "192x192" }} {{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }} {{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }} diff --git a/layouts/partials/home/background.html b/layouts/partials/home/background.html index c928413f..d67eece1 100644 --- a/layouts/partials/home/background.html +++ b/layouts/partials/home/background.html @@ -52,7 +52,7 @@ {{ if $authorImage }} {{ $final := $authorImage }} {{ $squareImage := $authorImage }} - {{ if not $disableImageOptimization }} + {{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }} {{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }} {{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }} diff --git a/layouts/partials/home/hero.html b/layouts/partials/home/hero.html index ed6d81ae..ec11ee0c 100644 --- a/layouts/partials/home/hero.html +++ b/layouts/partials/home/hero.html @@ -55,7 +55,7 @@ {{ if $authorImage }} {{ $final := $authorImage }} {{ $squareImage := $authorImage }} - {{ if not $disableImageOptimization }} + {{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }} {{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }} {{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }} diff --git a/layouts/partials/home/profile.html b/layouts/partials/home/profile.html index 2d27bf68..fdc137fe 100644 --- a/layouts/partials/home/profile.html +++ b/layouts/partials/home/profile.html @@ -14,7 +14,7 @@ {{ if $authorImage }} {{ $final := $authorImage }} {{ $squareImage := $authorImage }} - {{ if not $disableImageOptimization }} + {{ if not (or $disableImageOptimization (eq $authorImage.MediaType.SubType "svg")) }} {{ $final = $authorImage.Fill (print "288x288 q" ( $.Site.Params.Author.imagequality | default "96" )) }} {{ $shortSide := int (math.Min $authorImage.Width $authorImage.Height) }} {{ $squareImage = $authorImage.Crop (printf "%dx%d" $shortSide $shortSide ) }}