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?
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.$sitelang
- the context site language.$lang
- the context language.$vf
- the virtual folder for the context site.You can define your own tokens by adding an additional processor to resolveTokens
pipeline
Updated with 9.3 Resolve and Query Tokens
Resolve Tokens
$compatibleThemes
- path to all themes.$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 (by default:$linkableHomes
- paths to home items from linkable sites.$templates
- path to the current site templates$siteMedia
- paths to media folders specified in Additional Children
field on virtual media folder item.$sharedSites
- for multiroot fields, resolves shared site for the$rvSystemTemplates
- list of templates defined in a configuration.$xaRichTextProfile
- the XA.Foundation.Editing.DefaultRichTextProfile
setting value.Query Tokens
The resolveSearchQueryTokens pipeline is used to add search filters. This pipeline is defined in the Sitecore.XA.Foundation.Search.config file. By default, the following tokens are available:
TaggedTheSameAsCurrentPage|SxaTags
TaggedWithAtLeastOneTagFromCurrentPage|SxaTags
UnderCurrentPage
ExcludeCurrentPage
ItemsOfTheSameTemplateAsTheCurrentPage
ItemsWithTheSameValueInField|FieldName
please follow below links for details in token customization.
You have to extend the "resolveVariantTokens" processor.