Skip to content

Commit 2d1244e

Browse files
committed
fix: fixed optional featured image into publications
1 parent c0b4281 commit 2d1244e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/pages/writing/[...slug].astro

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ const { Content } = await render(entry);
3333
</div>
3434
<h1 class="text-3xl font-semibold text-headings">{entry.data.title}</h1>
3535
</div>
36-
<div class="relative aspect-video overflow-hidden rounded-lg">
37-
<Image
38-
src={entry.data.image}
39-
alt={entry.data.title}
40-
class="object-cover"
41-
/>
42-
</div>
36+
{entry.data.image && (
37+
<div class="relative aspect-video overflow-hidden rounded-lg">
38+
<Image
39+
src={entry.data.image?.src}
40+
alt={entry.data.title}
41+
width={entry.data.image?.width}
42+
height={entry.data.image?.height}
43+
class="object-cover"
44+
/>
45+
</div>
46+
)}
4347
<div class="prose dark:prose-invert">
4448
<Content />
4549
</div>

0 commit comments

Comments
 (0)