diff --git a/src/templates/blog-post.tsx b/src/templates/blog-post.tsx index 5c2262cb2..2f2b809d1 100644 --- a/src/templates/blog-post.tsx +++ b/src/templates/blog-post.tsx @@ -46,7 +46,10 @@ export const Head = ({ const { author, seoMetaText, title, publicationDate, heroImage } = data.contentfulBlogPost; - const shareImagePath = heroImage.shareImage.resize.src; + let shareImagePath = ''; + if (heroImage && heroImage.shareImage && heroImage.shareImage.resize) { + shareImagePath = heroImage.shareImage.resize.src; + } /* * SEO Notes: