We're building a website using SXA. The website has scope for reusing components.

Say we have added a carousel Component (or take any ootb SXA component) in Page A. We want to reuse the same component (from Page A) without adding a new carousel component in Page B - and only change the datasource in Page B so that Page A and Page B use only one component with 2 different data items.

How can this be achieved basically in SXA?

Thanks in advance.

  • Not sure what you actually want to achieve, but I think you need to take a look at snippets: doc.sitecore.com/users/sxa/17/sitecore-experience-accelerator/…
    – Gatogordo
    Dec 2 '19 at 10:33
  • Basically, we want to reuse an SXA component in different pages where the same component in each page has unique data. Is this possible in SXA? Dec 2 '19 at 10:41
  • Why do you need the same component? As opposed to dropping the component onto each page? Is it just the re-configuration that you are trying to avoid? Snippet seem the way to go where you could have a child (or central) datasource.
    – Jen
    Dec 2 '19 at 23:32

If you want the exact same component - that is not possible. That is probably referring to partial designs - which offer that functionality but those include the full component with its datasource.

If you want to reuse components (or sets of components) and still be able to change the datasource, snippets might be a solution. They can be easily created (https://doc.sitecore.com/users/sxa/19/sitecore-experience-accelerator/en/add,-reuse,-and-edit-a-snippet.html) and can contain one or more components. I would assume they are not used that often for just one component - more often it's a grid structure with more than one component that is added to the snippet but you are free to use as pleased.

You can configure the snippet (https://doc.sitecore.com/users/sxa/19/sitecore-experience-accelerator/en/configure-a-snippet.html) to use global sources or local ones (that you can alter without changing the other usages of the snippet.

But as mentioned, those snippets are intended mostly to combine multiple components to be reused. If you just have one component, that can be easily added as is.

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.