From 3b0393d5535261f21662fa4b055160dc08b39085 Mon Sep 17 00:00:00 2001 From: Aphcity Date: Wed, 20 Mar 2024 10:03:59 +0800 Subject: [PATCH] Add remote image support to author image --- layouts/partials/author.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/layouts/partials/author.html b/layouts/partials/author.html index 50bc2cc3..c544a2fd 100644 --- a/layouts/partials/author.html +++ b/layouts/partials/author.html @@ -1,7 +1,12 @@ {{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
{{ with .Site.Author.image }} - {{ $authorImage := resources.Get . }} + {{ $authorImage := "" }} + {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} + {{ $authorImage = resources.GetRemote . }} + {{ else }} + {{ $authorImage = resources.Get . }} + {{ end }} {{ if $authorImage }} {{ if not $disableImageOptimization }} {{ $authorImage = $authorImage.Fill "192x192" }} @@ -31,4 +36,4 @@ {{ end }}
{{ partialCached "author-links.html" . }}
- \ No newline at end of file +