diff options
author | tdro <tdro@noreply.example.com> | 2022-06-24 03:36:33 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-06-24 03:36:33 -0400 |
commit | d8835677c49292d9186003df777ece0670ba742e (patch) | |
tree | 340cc61d2cddf0c349e970cfa68ed6b7fd0948b3 /themes/default/layouts/partials/author-card.html | |
parent | f140c37f83753d620bdf3499843e3d11ca4a131d (diff) | |
download | canory-d8835677c49292d9186003df777ece0670ba742e.tar.gz canory-d8835677c49292d9186003df777ece0670ba742e.tar.bz2 canory-d8835677c49292d9186003df777ece0670ba742e.zip |
themes/default: static/images -> data/media
Add media path. Translate static images to data media.
Diffstat (limited to 'themes/default/layouts/partials/author-card.html')
-rw-r--r-- | themes/default/layouts/partials/author-card.html | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 26a8e31..3e4bcca 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,6 +1,7 @@ {{- $path := print "public/" .Data.user "/media/profile/picture.png" -}} {{- $image := resources.Get $path -}} {{- $dimensions := "96x96" -}} +{{- $404image := resources.Get "data/media/404.png" -}} <micro-author> <micro-card> @@ -10,24 +11,22 @@ <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#"> <picture> {{- with $image }} - {{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) }} + {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .)) }} <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))).Fit $dimensions -}} + {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .))).Fit $dimensions -}} width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}" {{- end }} {{ else }} - {{- $404origin := print "/images/404.png" }} - {{- $404image := imageConfig (print "static/" $404origin) }} width="{{ $404image.Width }}" height="{{ $404image.Height }}" - src="{{ $404origin }}" + src="{{ $404image.RelPermalink }}" {{- end -}} /> </picture> |