diff options
Diffstat (limited to 'themes/default/layouts/partials/author-picture.html')
-rw-r--r-- | themes/default/layouts/partials/author-picture.html | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index d2c3c6f..05d5cf1 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -1,32 +1,33 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $profile := $author.picture.profile -}} -{{- $file := not (urls.Parse $profile).Host -}} +{{- $metadata := print "public/" $author.user "/author.json" -}} -{{- if $file -}} - {{- $profile = print $author.user "/" $profile -}} -{{- end -}} - -{{- $image := partial "function-caches-images.html" - (dict - "Source" $profile - "Fit" "160x160" - "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") - "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $profile)) - "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") - ) --}} - -{{- $width := $image.Width -}} -{{- $height := $image.Height -}} -{{- $source := $image.RelPermalink -}} {{- $alternate := $author.name -}} -{{- $sourceset := $image.AltRelPermalink -}} +{{- $width := "" -}} +{{- $height := "" -}} +{{- $source := "" -}} +{{- $sourceset := "" -}} {{- with .Params.feed.favicon -}} + {{- $alternate = $.Params.feed.name -}} {{- $width = "64" -}} {{- $height = "64" -}} {{- $source = $.Params.feed.favicon -}} - {{- $alternate = $.Params.feed.name -}} + {{- $sourceset = "" -}} +{{- else -}} + {{- $source = print "/" (partial "function-paths.html" "media") "/" $author.user "/" $author.user "-profile" (path.Ext $author.picture.profile) -}} + {{- $sourceset = print "/" (partial "function-paths.html" "media") "/" $author.user "/" $author.user "-profile.webp" -}} + {{- with $metadata := resources.Get $metadata -}} + {{- $metadata = $metadata.Content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} + {{- else -}} + {{- $source = "/data/media/404.png" -}} + {{- $sourceset = "" -}} + {{- end -}} +{{- end -}} + +{{- if not (path.Ext $author.picture.profile) -}} + {{- $source = "/data/media/404.png" -}} {{- $sourceset = "" -}} {{- end -}} |