2

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.

3 Answers 3

4

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.

2
  • 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
    Commented Jul 11, 2018 at 21:29
  • ``` code { display: none; } .scChromeData{ display: none; }
    – Alex Shyba
    Commented Jul 19, 2018 at 21:25
2

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; }

1

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

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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