Closed ryan-talus closed 1 year ago
Thanks @ryan-talus I'll test this out and merge it in!
Thanks—let me know if I should change anything in the PR!
Hi @graysonhicks Any update on this issue? Planed release to include this feature? Thanks
Merged and released with 3.6.2
, thanks!
Oops, the changes on this PR were on the wrong gatsby-node file. Fixed and published as 3.6.3
Just found this plugin today, it's extremely helpful!
I hit this same issue: https://github.com/graysonhicks/gatsby-plugin-remote-images/issues/120
I'm using this plugin with another which creates a structure with a lot of null values so I've added a quick, minimal-changes fix.
This adds an option,
skipUndefinedUrls
, which short-circuits node creation where either theurl
passed tocreateImageNode()
is falsy or theurl
returned fromprepareUrl()
(when defined) is falsy. This skips undefinedurls
and adds an easy way for the user to implement their own "undefined" values by returning undefined from theprepareUrl()
function.Example of using this change to set options to skip both
null
urls
andurls
which are'N/A'
:Default behavior (without setting
skipUndefinedUrls: true
is unchanged so that the currently implemented errors aren't affected.