Add fallback for img src's
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tobias 2024-05-19 18:59:51 +02:00
parent 523b7c9fd7
commit 0a2dde8009
3 changed files with 5 additions and 5 deletions

BIN
astro/public/not-found.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -12,7 +12,7 @@ const contentArray = getContentArray(content);
} else {
return (
<Image
src={getImageSrc(value.src)}
src={getImageSrc(value.src) || "/not-found.png"}
width={value.width}
height={value.height}
format="webp"

View File

@ -9,9 +9,9 @@ const { post } = Astro.props;
>
<article class="flex px-5 py-3 gap-8">
<Image
src={post.thumbnail.url}
height="150"
aspectRatio="1"
src={post.thumbnail.url || "/not-found"}
height={150}
aspectRatio={1}
format="webp"
alt={post.thumbnail.alt}
/>