1

The datasource location field of the renderings after deploying the items with JSS is by default : ./Page Components|/sitecore/content/tudorlocal/Components/ContentTest

However, when adding a rendering through the experience editor and selecting the data source, the window displays the page components folder twice.

enter image description here

I found the answer to this question: Datasource Location not working as expected. Putting 'query:' in front of the path solves the issue. But at every new deployment, the value gets overwritten.

Is there a way to set it code-first with JSS, or to prevent the field to be overwritten?

2

You may not able to just prevent the "Datasource Location" field alone to be overwritten. Because the pipeline "ProcessRenderings" in .\App_Config\Sitecore\JavaScriptServices\Sitecore.JavaScriptServices.AppServices.config updates this. This is the one which creates renderings and other mandatory process for renderings as well.

<pipelines>
      <group groupName="javaScriptServices">
        <pipelines>
          <import>
            ...
            <processor type="Sitecore.JavaScriptServices.AppServices.Pipelines.Import.ProcessRenderings, Sitecore.JavaScriptServices.AppServices" resolve="true" />
          </import>
        </pipelines>
      </group>
</pipelines>

Overwriting this may not be easy, So you can consider assigning security to the renderings where you don't have additional updates from jss. Select your rendering control which shouldn't be updated by JSS deploy, unprotect item to see additional options under "Security" tab something like "JSS Import - No Overwrite".

enter image description here

This will Deny write access to the item and its descendants for the sitecore\JSS Import Service User role. So ultimately your import process will not overwrite any field values on the item. You can do by deny write access when assigning security.

Refer this Sitecore document for additional details.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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