From 3e3876b6f230ab66ebecc0dca52341a78f41e5f6 Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Tue, 6 Aug 2019 01:44:17 +0200 Subject: [PATCH] Fall back to image URL for GIFs and SVGs --- src/templates/post.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/templates/post.js b/src/templates/post.js index 8597c81..5d64b18 100644 --- a/src/templates/post.js +++ b/src/templates/post.js @@ -18,7 +18,8 @@ export const BlogPostTemplate = ({ author, featuredMedia, }) => { - const hasFeaturedMedia = featuredMedia && !!featuredMedia.localFile + const hasFeaturedMedia = + featuredMedia && (!!featuredMedia.localFile || !!featuredMedia.url) return (
- + {featuredMedia.localFile.childImageSharp ? ( + + ) : ( + {featuredMedia.caption + )} {featuredMedia.caption && ( -
- )} +
+ )}
- )}