Image URL doesn't exist while using Sitecore with React JS?

681 Views Asked by At

I want to render images through Sitecore JSS and trying to include the JSON using the CommonFieldTypes.Image property. I'm following the documentation from https://jss.sitecore.com/docs/techniques/working-disconnected/manifest-api#fieldtypes but couldn't get it working. I'm using Sitecore with Reactjs.

fields:{
 "articleImage": {
     "value": {
        "src": "../../../media/image.jpg",
        "alt": "img",
      }
  },
}

Getting the following error:

Source media file referred to in manifest data doesn't exist:

What am I missing, please?

1

There are 1 best solutions below

0
Peter Procházka On

You should define them like this in your route:

fields:
 articleImage: 
  src: ../../../media/image.jpg
  alt: img

Mind the tabs at the beginning. They need to be formatted correctly otherwise it won't work.