aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-card.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-11 23:15:33 -0400
committertdro <tdro@noreply.example.com>2022-06-11 23:15:33 -0400
commitea9c7faaaa82401bc8e32efd40c353a2696ac0b9 (patch)
treedb17f9cd7d6b720d3ea86a2afd76a6253de307e4 /themes/default/layouts/partials/author-card.html
parented5ac80fac302574d5643bf6f69066805d520075 (diff)
downloadcanory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.tar.gz
canory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.tar.bz2
canory-ea9c7faaaa82401bc8e32efd40c353a2696ac0b9.zip
themes/default/layouts: Try fit instead of resize
Default to webp, and use fit method. Might produce better image rendering overall.
Diffstat (limited to 'themes/default/layouts/partials/author-card.html')
-rw-r--r--themes/default/layouts/partials/author-card.html11
1 files changed, 5 insertions, 6 deletions
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html
index b05daa5..efdf256 100644
--- a/themes/default/layouts/partials/author-card.html
+++ b/themes/default/layouts/partials/author-card.html
@@ -1,5 +1,6 @@
-{{- $path := print "public/" .Data.user "/media/profile/picture.png" -}}
-{{- $image := resources.Get $path -}}
+{{- $path := print "public/" .Data.user "/media/profile/picture.png" -}}
+{{- $image := resources.Get $path -}}
+{{- $dimensions := "96x96" -}}
<micro-author>
<micro-card>
@@ -10,15 +11,13 @@
<picture>
{{- with $image }}
{{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) }}
- <source srcset="{{- ($image.Resize "x64 png").RelPermalink -}}" type="image/png" />
- <source srcset="{{- ($image.Resize "x64 jpg").RelPermalink -}}" type="image/jpeg" />
- <source srcset="{{- ($image.Resize "x64 webp").RelPermalink -}}" type="image/webp" />
+ <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" />
{{- end }}
<img
alt="{{ .Data.name }}"
{{- if fileExists $path }}
{{ with $image }}
- {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Resize "x64" -}}
+ {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Fit $dimensions -}}
width="{{ $image.Width }}"
height="{{ $image.Height }}"
src="{{ $image.RelPermalink }}"