How to set a fallback image for records
This is an Indexing pipeline step
If some of your records don’t have images your UI may look suboptimal, with empty boxes appearing with your search results.
Thankfully there is a simple way to set fallback images for records:
First navigate to Indexing.
In the advanced editor add the following:
Note that it is recommended that this step should be placed higher up the YAML file.
- id: set-field params: field: constant: image value: constant: "https://picsum.photos/200/300" condition: fields.image = '' OR !fields.image
This step is checking if the
image (be sure to change the field name if your image field is called something different!) field is empty or is
null. If it is, then it is storing the default value set in the
value: constant: param (here we are just grabbing a placeholder image from online, but you should add your own fallback image URL) into the
image field. If the
image field already has a value then it will be skipped.
That’s all! Test it out using the pipeline populate tool and if it’s working correctly then save the pipeline and you’re done 🥳