ux: add error handling image not found

This commit is contained in:
Henk Verlinde 2022-01-14 10:42:40 +01:00
parent f6d3a754c2
commit 96ec7cbcf4
1 changed files with 25 additions and 21 deletions

View File

@ -1,4 +1,5 @@
{{ $image := .Page.Resources.GetMatch .Destination -}} {{ $image := .Page.Resources.GetMatch .Destination -}}
{{ with $image -}}
{{ $lqip := $image.Resize site.Params.lqipWidth -}} {{ $lqip := $image.Resize site.Params.lqipWidth -}}
{{ $imgSrc := "" -}} {{ $imgSrc := "" -}}
@ -25,3 +26,6 @@
{{ else -}} {{ else -}}
<img class="img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $.Text }}"> <img class="img-fluid lazyload blur-up" src="{{ $lqip.Permalink }}" data-src="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" alt="{{ $.Text }}">
{{ end -}} {{ end -}}
{{ else -}}
{{ erroridf "image-not-found" "Image not found" -}}
{{ end -}}