-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gracefully handle empty image URL fields #177
Comments
Hey @moneal and thanks for opening this issue. I've noted this question in our team's backlog so that we can set some time aside to look into it soon. I'll be sure to follow up with any updates or questions here. |
Hey @moneal I wanted to take a second to follow up on this. Because configuration functions are no longer possible in Gatsby V4, we can no longer accept That being said, I want to better understand your need here. Do you mind explaining to me the use case for trying to resolve the From your comment, it sounds like you'd like to opt-out of actually retrieving the field value when the node in question has no image. |
I'm going to go ahead and close this issue, but should anything else come up please do comment and I'll be sure to open it again. |
Thank you for your time. I indeed was wanting to opt-out when the node had no image. This was for an older project and no longer an issue for me but might be for someone else in the future. |
Thanks for getting back to me @moneal! I'm going to leave this ticket open to gauge interest in this feature. If anyone else would like to see this added, please comment or react to this post. That will help us measure community interest and prioritize this accordingly. |
How do you handle a source that may or may not have a value for a field?
I have content sourced from a Google Spreadsheet, this spreadsheet has a column called
img
with a URL to a publicly accessible image. This column might be null or have a string.To debug the setup I configured the plugin without a defined rawURLKey and produced this error:
When configuring the plugin with the suggestions and settings I think are correct, like this:
The following error is thrown and the build or develop task crashes.
Everything seems to work fine if the source has a string populated for every record.
Fragment partial that for getting image data:
Pre version 2 it seemed possible to work around the error by using something like
getURL: (node) => node.img || 'https://example.com/file.jpg'
The text was updated successfully, but these errors were encountered: