Condition to control Featured Image display #24001
Replies: 2 comments
-
Hi there, @emmadigital! It looks like perhaps your conditional rendering should use the logical see example here If that doesn't resolve your issue, it would be incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it. If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look. Thanks for using Gatsby! 💜 |
Beta Was this translation helpful? Give feedback.
-
@madalynrose thanks for responding and sharing the example link. I have updated my code to below:
Can you check my build error, is this because of this condition. As I don't see it highlights this code but it talks about featuredimage, why does the build fails. Here is my repo: https://github.com/emmadigital/ardalis-newsite |
Beta Was this translation helpful? Give feedback.
-
Summary
I want to set featured image optional for my blog posts. I am using Netlify with Netlify CMS.
Relevant information
This is how I created the condition to display featured image if its not null. But this sometime gives build error:
GraphQL Query
Build Error
Environment (if relevant)
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/APlease sugges how should I create confition to display featured image and if its null then it should skip the display.
Beta Was this translation helpful? Give feedback.
All reactions