The SXA pipelines

Current version: 10.0

Understanding how the SXA pipelines and their processors work provides you with an insight into how dependencies are rendered, how tokens for rendering variants are created, how CSS classes are generated, and so on.

A pipeline consists of a sequence of processors. A processor is a .NET class that implements a method. When a pipeline is invoked, the processors are run in order. You can extend and customize the pipelines by adding or replacing processors. Extending a pipeline involves modifying the pipeline definition located in a Sitecore patch file.

resolveVariantTokens

The resolveVariantTokens pipeline is used to create tokens for rendering variants.

This pipeline includes the following processors:

Processor

Description

ResolveIFileTypeIcon

Renders the span HTML element with the class according to the extension of the file.

ResolveItemId

Specifies the ID of the content item to be resolved.

ResolveItemName

Specifies the name of the content item to be resolved.

ResolveSize

Renders the file size.

decoratePage

The decoratePage pipeline is used to decorate the page <body> tag with attributes. These can be standard attributes, such as id or class, but you can also add custom data attributes.

decorateRendering

The decorateRendering pipeline is used to decorate the rendering's outer <div> tag with attributes. These can be standard attributes, such as id or class, but you can also add custom data attributes.

RequestResponse
<div class="component title">
<div class="component-content">
<h2 class="field-title">
Title of the page
</h2>
</div>
</div>

mediaRequestHandler

The mediaRequestHandler pipeline is used in the SXA media requests handler. The mediaRequestHandler pipeline is defined in the Sitecore.XA.Foundation.MediaRequestHandler.config file.

This file extends the standard media request handler by adding a pipeline that implements custom functionalities such as the support of wireframe images or providing optimized assets.

This pipeline includes the following processors:

Processor

Description

ParseMediaRequest

Checks if the HTTP request is a valid media type. If not, the pipeline is aborted.

GetMediaFromUrl

Determines the media item from the URL that is stored in HTTP request.

HandleErrors

Redirects the user to an error page.

resolveTokens

The resolveTokens pipeline is used to resolve tokens that can be used in queries. For example:

  • $compatibleThemes - path to all themes.

  • $theme - currently used theme.

  • $pageDesigns - root of page designs (sitecore/content/Tenant/Site/Presentation/Page Designs).

  • $partialDesigns - root of partial designs (sitecore/content/Tenant/Site/Presentation/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: /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.

  • $rvSystemTemplates - list of templates defined in a configuration. These templates are used to feed the AllowedInTemplates field for rendering variants.

  • $xaRichTextProfile - the XA.Foundation.Editing.DefaultRichTextProfile setting value.

By adding new processors to this pipeline, you can design new tokens.

This pipeline is defined in the Sitecore.XA.Foundation.TokenResolution.config file and includes the following processors:

Processor

Description

CurrentTemplateToken

Determines the current tokens used.

EscapeQueryTokens

Used to escape tokens that are used in Sitecore queries.

assetService

The assetService pipeline is responsible for assets optimization. This pipeline includes the AddEditingtheme processor, which you can use to add a theme when you are in Edit mode.

RequestResponse
<assetService>
        <processor type="Sitecore.XA.Foundation.Editing.Pipelines.AssetService.AddEditingTheme, Sitecore.XA.Foundation.Editing" />
      </assetService>

getControlEditability

The getControlEditability pipeline is used to check if a rendering should be editable or not. It is defined in the Sitecore.XA.Foundation.Editing.config file. Used in Editing, Composites, LocalDatasources.

RequestResponse
<getControlEditability>
        <processor type="Sitecore.XA.Foundation.Editing.Pipelines.GetControlEditability.IsRenderingInCurrentItemRenderings, Sitecore.XA.Foundation.Editing" />
      </getControlEditability>

It contains the IsRenderingInCurrentItemRenderings processor that checks the component XML to see if it contains other component (by unique ID).

getRobotsContent

The getRobotsContent pipeline is used to extend the response provided to search crawler robots in the robots.txt file. The Robots.txt file is a simple text file on your site’s root directory that tells search engine robots what to crawl and what not to crawl on your site. The getRobotsContent pipeline contains the following processors:

Processor

Description

GetContentFromSettings

Checks if the robots' content field is filled and uses its value.

GetDefaultRobotsContent

Checks the robots.txt file for a value when the robots' content field is empty.

AppendSitemapUrl

Adds the path of the sitemap.xml file to the robots' content field.

refreshHttpRoutes

The refreshHttpRoutes pipeline is used to refresh HTTP routes after changes in site configuration.

resolveSearchQueryTokens

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

  • CurrentLanguage

resolveBoostingQuery

The resolveBoostingQuery pipeline is used to add extension point that can be used to write your own search boosting rules and then use them in SXA. To do that you can write your own custom rule and use the resolveBoostingQuerypipeline to turn it into a query. This pipeline is defined in Sitecore.XA.Foundation.Search.config file and includes the following processor:

RequestResponse
resolveBoostingQuery
    processor type="Sitecore.XA.Foundation.Search.Pipelines.ResolveBoostingQuery.ResolveFieldAndQueryMatchRule, Sitecore.XA.Foundation.Search" resolve="true" /
/resolveBoostingQuery

encodeFacetValue

The encodeFacetValue pipeline is used in search logic to encode/escape facet values that are sent to search providers. It is used to escape special characters for Azure and Solr search. This pipeline is defined in the Sitecore.XA.Foundation.Search.config file.

RequestResponse
<encodeFacetValue>
     <processor type="Sitecore.XA.Foundation.Search.Pipelines.EncodeFacetValue.EscapeValue, Sitecore.XA.Foundation.Search" resolve="true" />
</encodeFacetValue>

getStyles

The getStyles pipeline is used to get all styles from current and shared sites. This pipeline is defined in the Sitecore.XA.Foundation.Presentation.config file and includes the following processors:

Processor

Description

GetSiteStyles

Gets all styles on the site.

GetSharedStyles

Gets all styles on shared sites.

processSearchItems

The processSearchItems pipeline is triggered after the search results items return and before sending them to the browser. It can enrich search result items with models that can be rendered on the page using the Model and Model Iterator variant items.

The ProcessSearchItemsArgs pipeline contains two properties:

  • Items - list of original items.

  • SearchItems - list that contains SearchItem objects. This SearchItem object contains Item and Model (of type Object). Users can assign whatever they want to the Model property and use it in rendering variants.

generateScribanContext

The generateScribanContext pipeline adds additional objects and functions to the Scriban context that you can use in Scriban templates. This pipeline adds i_page, i_site objects, or sc_field functions.

getScribanItemMembers

The getScribanItemMembers pipeline extends item objects available in the Scriban templates ( i_page, i_site, and so on) with additional properties. For example:

  • i_page.name - returns page name

  • i_page.language - returns page language name

  • i_home.version - returns version number of home item

Do you have some feedback for us?

If you have suggestions for improving this article,