4

In SXA we have components like the Rich Text component that have a version with a local datasource and a reusable version that gets a datasource from a global (site) folder.

This all works fine and I can see local data folders being created and text items appearing in the global site data folders under "Texts".

If I understand correctly the only real difference between the two versions of the RichText component is on creation - the local one doesn't ask anything and creates a local data item, the reusable one does ask for a datasource.

So my question is: how can I use this behavior in my custom rendering? What are the steps I need to take to have a local and reusable version of my custom control?

1 Answer 1

5

If you will open for example Sitecore.XA.Feature.PageContent.config you will see there <autoDatasourceRenderings> section.

You can use that section and put there your rendering ID - this will automatically create data source for you.

When local data source will be created, the Data Source field inside of your rendering properties should have something like this: local:/Data/Text 1. And under your page item there should be: enter image description here

UPDATE: In the newer versions of SXA we started to use "Other properties" field in the Experience Accelerator section of the rendering item (it is no longer in the config files):

enter image description here

2
  • Looks like this is quite different in newer SXA versions. Commented Jan 7, 2021 at 2:40
  • 1
    @MarkGibbons I updated my answer. In newer versions, those settings have been moved to "Other properties" field on the rendering item. Commented Jan 8, 2021 at 13:09

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.