From 79279e4ab1df119a8a1779467ada81d52a4eca5b Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 12 May 2023 21:27:03 +0200 Subject: [PATCH] fix: catch undefined article --- src/components/post.astro | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/post.astro b/src/components/post.astro index f0336b9..589e9a1 100644 --- a/src/components/post.astro +++ b/src/components/post.astro @@ -1,14 +1,12 @@ --- import { ArticleData } from "@extractus/article-extractor"; -import CSS from "./post.module.scss"; - -const article = Astro.props.article; - export interface Props { article: ArticleData; } + +const article = Astro.props.article; const datePublished = - article.published && new Date(article.published).toDateString(); + article?.published && new Date(article.published).toDateString(); --- {