From 9cd0915b1b01d6e33509bba8830e11f5ab5ef309 Mon Sep 17 00:00:00 2001 From: niccofyren Date: Mon, 23 Sep 2024 07:31:59 +0200 Subject: [PATCH] fix: handle case where main image is missing (#12) --- src/components/NewsComp.astro | 6 +++--- src/pages/news/[slug].astro | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/NewsComp.astro b/src/components/NewsComp.astro index 166dc96..70827e6 100644 --- a/src/components/NewsComp.astro +++ b/src/components/NewsComp.astro @@ -15,7 +15,7 @@ interface Article { name: string; slug: string; }>; - main_image: { + main_image?: { url: string; full_url: string; width: number; @@ -75,11 +75,11 @@ const articles = await fetchArticles(); )} - {article.main_image.alt} + />} )) diff --git a/src/pages/news/[slug].astro b/src/pages/news/[slug].astro index 755528c..cec3278 100644 --- a/src/pages/news/[slug].astro +++ b/src/pages/news/[slug].astro @@ -84,12 +84,12 @@ const article = await fetchArticleById(articleId); {new Date(article.meta.first_published_at).toLocaleDateString()} - {article.main_image.alt} + />}
- \ No newline at end of file +