diff options
Diffstat (limited to 'themes/default/layouts/partials/author-card.html')
-rw-r--r-- | themes/default/layouts/partials/author-card.html | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 3da9ab2..2897e62 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,5 +1,4 @@ -{{- $profile := .Data.picture.profile -}} -{{- $file := not (urls.Parse $profile).Host -}} +{{- $metadata := print "public/" .Data.user "/author.json" -}} {{- $host := (urls.Parse ("" | absURL)).Host -}} @@ -7,31 +6,24 @@ {{- $host = "localhost" -}} {{- end -}} -{{- if $file -}} - {{- $profile = print .Data.user "/" $profile -}} -{{- end -}} +{{- $alternate := .Data.name -}} +{{- $width := "" -}} +{{- $height := "" -}} +{{- $source := "" -}} +{{- $sourceset := "" -}} -{{- $image := partial "function-caches-images.html" - (dict - "Source" $profile - "Fit" "160x160" - "Target" (print (partial "function-paths.html" "media") "/" .Data.user "/") - "Copy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.Base $profile)) - "AlternateCopy" (print (partial "function-paths.html" "media") "/" .Data.user "/" (path.BaseName $profile) ".webp") - ) --}} +{{- $source = print "/" (partial "function-paths.html" "media") "/" .Data.user "/" .Data.user "-profile" (path.Ext .Data.picture.profile) -}} +{{- $sourceset = print "/" (partial "function-paths.html" "media") "/" .Data.user "/" .Data.user "-profile.webp" -}} -{{- $width := $image.Width -}} -{{- $height := $image.Height -}} -{{- $source := $image.RelPermalink -}} -{{- $alternate := .Data.name -}} -{{- $sourceset := $image.AltRelPermalink -}} +{{- with $metadata := resources.Get $metadata -}} + {{- $metadata = $metadata.Content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} +{{- end -}} -{{- with .Params.feed.favicon -}} - {{- $width = "64" -}} - {{- $height = "64" -}} - {{- $source = $.Params.feed.favicon -}} - {{- $alternate = $.Params.feed.name -}} +{{- if not (fileExists (print "public/" $source)) -}} + {{- $source = "/data/media/404.png" -}} + {{- $sourceset = "" -}} {{- end -}} <micro-author> |