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 { } else {
return ( return (
<Image <Image
src={getImageSrc(value.src)} src={getImageSrc(value.src) || "/not-found.png"}
width={value.width} width={value.width}
height={value.height} height={value.height}
format="webp" format="webp"

View File

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