Skip to content

Commit cfc0642

Browse files
committed
feat: add fallback image to article image on summary page
1 parent d3e2fab commit cfc0642

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

resources/views/components/articles/summary.blade.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
<div class="break-words">
88
@if ($isFeatured)
99
<a href="{{ route('articles.show', $article->slug()) }}">
10-
<div class="w-full h-72 mb-6 rounded-lg bg-center {{ $article->hasHeroImage() ? 'bg-cover' : '' }} bg-gray-800" style="background-image: url({{ $article->heroImage() }});"></div>
10+
<img class="w-full h-72 mb-6 rounded-lg bg-center bg-gray-800"
11+
src="{{ $article->heroImage() }}"
12+
alt="Example image"
13+
onerror="
14+
this.onerror=null;
15+
this.src='images/default-background.svg';
16+
this.classList.add('image-error');"
17+
>
1118
</a>
1219
@endif
1320

0 commit comments

Comments
 (0)