diff options
author | tdro <tdro@noreply.example.com> | 2023-05-09 19:42:00 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-05-09 19:43:53 -0400 |
commit | eadbad7563dfa571127e962d343726d6eec469ae (patch) | |
tree | 1330f1c86723000b5f48a7803b991fcab3968b22 /themes | |
parent | 39b67f04cacd6d788e902188e7daf71b47ec1219 (diff) | |
download | canory-eadbad7563dfa571127e962d343726d6eec469ae.tar.gz canory-eadbad7563dfa571127e962d343726d6eec469ae.tar.bz2 canory-eadbad7563dfa571127e962d343726d6eec469ae.zip |
themes/default/layouts/partials/author-picture: Guard against empty metadata
Can be empty under some conditions
Diffstat (limited to 'themes')
-rw-r--r-- | themes/default/layouts/partials/author-picture.html | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index 9153e08..01786e7 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -20,9 +20,11 @@ {{- $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 -}} + {{- with $content := $metadata.Content -}} + {{- $metadata = $content | transform.Unmarshal -}} + {{- $width = $metadata.picture.profileWidth -}} + {{- $height = $metadata.picture.profileHeight -}} + {{- end -}} {{- else -}} {{- $source = "/data/media/404.png" -}} {{- $sourceset = "" -}} |