Here is my Sitecore tree

enter image description here

Here is my data item in the experience editor (using the default Welcome component). I removed the Sitecore background image that was in the CSS.

enter image description here

Here is what the layout API returns if I hit the url http://my-first-jss-app/sitecore/api/layout/render/jss?item=/test2&sc_apikey=xxx

enter image description here

We see that into my main placeholder there is some blocks named code around my Welcome component. It seems to be code from Sitecore experience editor...

Then when I run my app I got my component but also this strange code on my page.

enter image description here

Do you know where this is come from ? Please tell me if you need more informations.

up vote 4 down vote accepted

The layout service data you see from the API is accurate and will contain elements that Experience Editor needs for rendering via your JSS app. Layout service will only emit this data when you're logged into Sitecore.

You're likely seeing the "additional" Experience Editor chrome data because you're browsing to your app in the same browser instance where you're already logged into Sitecore (even if they're separate tabs they share cookies).

I would suggest browsing to your app in an incognito window.

  • 3
    Worth noting that in the next technical preview we will be shipping default sample app CSS that hides the edit mode code when using connected mode for development. – Kam Figy Jul 11 at 21:29
  • ``` code { display: none; } .scChromeData{ display: none; } – Alex Shyba Jul 19 at 21:25

In addition to Adam's answer, you can hide the extra markup with CSS so it doesn't look that weird when browsing the app in the same session :)

code { display: none; } .scChromeData{ display: none; }

You can add query param &sc_mode=preview and JSON will be clean again

Example: http://sc9.sc/sitecore/api/layout/render/jss?item=item1&sc_lang=en&sc_apikey=KEY&sc_mode=preview

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.