Currently, each time I'm doing deploying jss using

jss deploy package -c -d

I need to manually unprotect the Item of my App Layout to include my placeholders.

enter image description here

Any ideas how to stop this?

Thanks

up vote 2 down vote accepted

The placeholders for the layout item are handled a bit differently than placeholders defined within your JS components because they are the top level placeholders that Layout Service needs to render.

Two potential solutions:

  1. Create a component that is assigned to the main placeholder. Then in that component declare your PH__footer, PH__header and PH__main placeholders. Be sure to update your manifest declarations accordingly.

  2. In the /sitecore/config/jss-basic-app-vue-web.config file in your JS app, find the /configuration/sitecore/javaScriptServices/apps/app node and add the following attribute: rootPlaceholders="main,PH__footer,PH__header,PH__main" This will tell the import service which placeholders should be defined for the JSS app layout. Be sure to deploy/copy your modified config file to your Sitecore instance after making the change.

For #2, the app config node inherits default values from the app definition found in /App_Config/Sitecore/JavaScriptServices/Sitecore.JavaScriptServices.Apps.config in your Sitecore instance.

Also note: these approaches are valid for the other JS libs as well, e.g. React, Angular.

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.