Add remote image support to author image

This commit is contained in:
Aphcity 2024-03-20 10:03:59 +08:00 committed by GitHub
parent 10bf07a7b7
commit 3b0393d553
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,7 +1,12 @@
{{ $disableImageOptimization := .Site.Params.disableImageOptimization | default false }}
<div class="flex author">
{{ 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" }}