aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-header.html
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-06-01 19:16:58 -0400
committertdro <tdro@noreply.example.com>2022-06-01 19:16:58 -0400
commit473a08150b875112c522522e21fb542d3ec26736 (patch)
treeec1d5f7c9e7ce80d5d2073490ff6a35f5351b6a1 /themes/default/layouts/partials/author-header.html
parentdff47d17bb0ed4479bfb187b19ba1c8b1fa61226 (diff)
downloadcanory-473a08150b875112c522522e21fb542d3ec26736.tar.gz
canory-473a08150b875112c522522e21fb542d3ec26736.tar.bz2
canory-473a08150b875112c522522e21fb542d3ec26736.zip
themes/default/layouts: Handle image search errors
Namespace 404 image processing.
Diffstat (limited to 'themes/default/layouts/partials/author-header.html')
-rw-r--r--themes/default/layouts/partials/author-header.html20
1 files changed, 15 insertions, 5 deletions
diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html
index f987560..174d057 100644
--- a/themes/default/layouts/partials/author-header.html
+++ b/themes/default/layouts/partials/author-header.html
@@ -1,10 +1,20 @@
-{{- $file := "/profile/header.jpg" -}}
-{{- $image := imageConfig (print "content/" (partial "author-media-path.html" .) $file) -}}
+{{- $file := "/profile/header.jpg" -}}
+{{- $path := print "content/" (partial "author-media-path.html" .) $file -}}
-<img
+{{- $404origin := print "/images/404.png" -}}
+{{- $404image := imageConfig (print "static/" $404origin) -}}
+
+<img
loading="lazy"
+ {{- if fileExists $path }}
+ {{ $image := imageConfig $path -}}
width="{{ $image.Width }}"
height="{{ $image.Height }}"
- alt="{{ partial "author-name.html" . }}"
- src="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}{{ $file }}"
+ src="{{ .Site.BaseURL }}/{{ partial "author-media-path.html" . }}{{ $file }}"
+ {{- else }}
+ width="{{ $404image.Width }}"
+ height="{{ $404image.Height }}"
+ src="{{ $404origin }}"
+ {{- end }}
+ alt="{{ partial "author-name.html" . }}"
/>