17

In SXA's out of the box renderings, I see datasource locations that look like this:

query:$site/*[@@name='Data']/*[@@templatename='Custom Folder']

Is $site the only token supported here? Can I inject my own tokens?

20

SXA tokens

There are other tokens as well:

  • $compatibleThemes - path to all themese
  • $theme - currently used theme
  • $pageDesigns - root of page designs
  • $partialDesigns - root of partial designs
  • $currenttemplate - name of the current template
  • $tenant - path to the current tenant
  • $site - path to the current site
  • $home - path to the current site start item (Home)
  • $linkableHomes - paths home items from linkable sites (see cross-site linking)
  • $templates - path to the current sitetemplates
  • $siteMedia - path to Virtual Media folder located under site
  • $sharedSites - for multiroot fields, resovles shared site for current tenant.
  • $rvSystemTemplates - returns list of templates defined in a configuration. Those template are used to feed AllowedInTemplates field for rendering variants.
  • $xaRichTextProfile - returns XA.Foundation.Editing.DefaultRichTextProfile setting value.

How to define custom tokens

You can define your own tokens by adding an additional processor to resolveTokens pipeline

|improve this answer|||||
0

please follow below links for details in token customization.

https://doc.sitecore.com/developers/sxa/18/sitecore-experience-accelerator/en/create-a-custom-token-for-a-rendering-variant.html

You have to extend the "resolveVariantTokens" processor.

|improve this answer|||||
  • This is not what the OP asked. There's a difference between the varianttokens and tokens. He has to extend the "resolveTokens" processor instead of "resolveVariantTokens". There are also plenty of great guides for that though, e.g. blog.binboy.net/post/sxa-create-custom-token-query – T_D Oct 21 '19 at 14:44

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.