diff --git a/src/templates/blog-post.tsx b/src/templates/blog-post.tsx index 5c2262cb2..ef1a8f2be 100644 --- a/src/templates/blog-post.tsx +++ b/src/templates/blog-post.tsx @@ -46,8 +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: * Recommended meta description length these days is 120 - 158 characters. The lower number is relevant for mobile devices.