3

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?

4

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 data source for you.

When local datasource 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

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.