I'm working with the React JSS Basic example. I created a new item based on the default "Welcome" component and I'm trying to retrieve it through JSS.

Here is my Sitecore tree :

Sitecore tree

To get Welcome-1 item (default one) I use this url : http://my-first-jss-app/sitecore/api/layout/render/jss?item=/&sc_apikey=xxx&tracking=false

I try to get Welcome-2 item with different urls but it results in a 404 error. Some urls that I tried :

I already read the layout service documentation that says the path must be “The path to the item, relative to the context site's home item”. This is the case in my urls but it doesn't work.

So I have two questions:

  • Why my url to display Welcome-2 item is not correct ?
  • Why Welcome-1 item is displayed when I reach “item=/” ?

Thanks

up vote 3 down vote accepted

item=/ returns the page item /sitecore/content/my-first-jss-app/Home, not the Welcome-1 data source item. Welcome-1 and Welcome-2 are only items containing data, but no layout or presentation.

Welcome-1 item data is displayed when you reach item=/ because this item is configured in the data source field of the Welcome rendering that is present in the presentation details of the Home item.

  • 1
    @JohnB The Layout Service only retrieves items which have Sitecore Layout on them. Your structure seems odd, Welcome-1 and Welcome-2 should perhaps be child items of Welcome, and then you can configure the Rendering to return child items as well. – techphoria414 Jul 11 at 14:15

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.