I have an sxa multisite solution where a template has been used across 2 sites. The template has a droptree field with source in template as /sitecore/content/tenant/site1/data/tag. However, when I used the item based on the same template in site 2, the datasource for the droptree field always points to the site 1 tag folder.

Any way of handling it, so that source dynamically picks up the site name.

  • 3
    Something like $site:/data/tag
    – Mark Cassidy
    Commented Jul 20, 2021 at 13:39
  • Thanks Mark it's working fine with the query you provided.
    – Roger
    Commented Jul 21, 2021 at 4:23

2 Answers 2


As Mark mentioned in his comment you should use the SXA tokens to achieve this. You can find a list here: https://doc.sitecore.com/en/developers/sxa/101/sitecore-experience-accelerator/the-sxa-pipelines.html

Useful ones for sources in templates could be:

  • $tenant - path to the current tenant.
  • $site - path to the current site.
  • $home - path to the current site start item (by default: /sitecore/content/Tenant/Site/Home).
  • $linkableHomes - paths to home items from linkable sites.
  • $templates - path to the current site templates (/sitecore/templates/Project/Tenant).
  • $siteMedia - paths to media folders specified in Additional Children field on virtual media folder item.
  • $sharedSites - for multiroot fields, resolves shared site for the current tenant.

In your case you'll need the $site token.

You'll need to set the source to: query:$site/Data/tag. (You need to start the source with "query" to make the tokens work).


If your depth of data source is is same in both sites. Below should work,


.. is a parent selector. You can increase based on the depth you have. My depth of data source is 1, as mentioned below screenshot. enter image description here

Site1: contains two elements enter image description here

Site2: contains three elements enter image description here

  • 1
    Yea the query: approach is how we used to do it. It would need to include something like ancestor-or-self:*[@templatename='Site Root'] or similar. But with SXA we have tokens that help achieve this, like $site and $sharedSites and so on.
    – Mark Cassidy
    Commented Jul 20, 2021 at 14:29

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.