How to create complete URL using a URL path
This is an Indexing pipeline step
Sometimes data stored in the index can be incomplete. It is common to see image URLs stored in the index as just their paths. For example, the image URL may be https://via.placeholder.com/300/09f.png
, but only the path is stored in the index as '/300/09f.png'
.
This can cause issues such as not being able to see record previews with their images in the console, as well as images not displaying on the frontend.
Thankfully, you can fix this by adding a simple step in your indexing pipeline that combines your domain with the image path to form a complete URL.
First navigate to your indexing pipeline and click on 'Advanced'.
Then add the following step:
- id: string-eval
params:
expression:
constant: ("https://via.placeholder.com"+fields.image)
field:
constant: image
condition: fields.image
Yo want to replace https://via.placeholder.com
with your own website’s URL and rename image
to your own schema field for your images if it is different.
What’s happening here is:
We are taking the
https://via.placeholder.com
URL and appending the value inimage
(the image path) to it.We are then writing the resulting string (
https://via.placeholder.com/300/09f.png
) to the image schema field.We are ensuring this step only runs if the record being ingested has a value stored in the
image
schema field.
Test an upload using the Preview tool and then click Save.
Now you have a complete image URL 🥳 .