I have a blog website, and a page where I can view and search in all the blog posts I have so far. Each blog is tagged with 1-2 tags in the "tagging" field in their respective item on Sitecore 9.

I'm using the "Search Results" SXA component to view all the search results for all blog posts, and a rendering variant to show specific fields from the blog posts, e.g. "title","date" stuff like that.

My question: Is there a way I can show the tags of each individual blog post in the search results using a rendering variant for the search results? If not, is there any other way I can implement this?

1 Answer 1


You can do this. Use VariantReference and then VariantField or VariantToken items and display tag name or field value:

enter image description here

Thanks to a number of extension points in SXA it's fairly easy to implement a custom solution for this.

There is resolveVariantTokens pipeline which contains, for example, such processors:

    <processor type="Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.ResolveVariantTokens.ResolveIFileTypeIcon, Sitecore.XA.Foundation.Variants.Abstractions" resolve="true" />
    <processor type="Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.ResolveVariantTokens.ResolveItemId, Sitecore.XA.Foundation.Variants.Abstractions" resolve="true" />
    <processor type="Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.ResolveVariantTokens.ResolveItemName, Sitecore.XA.Foundation.Variants.Abstractions" resolve="true" />
    <processor type="Sitecore.XA.Foundation.Variants.Abstractions.Pipelines.ResolveVariantTokens.ResolveSize, Sitecore.XA.Foundation.Variants.Abstractions" resolve="true" />

Investigate one or two of them. You will notice that it's quite easy to add your own token called for example $tags and then use it in Token variant item like this:

enter image description here

Your custom processor would simply gets tags out of an item and just return tags name or <span class="tag-something>TAG_NAME</span>.

  • Will the Reference in the variant definition work with a multilist field? Wasn't sure about that one as the documentation only mentions fields linking to a single item.
    – Gatogordo
    Commented May 24, 2018 at 13:00
  • 1
    @Gatogordo It should handle FielField, ImageField, LinkField, ReferenceField, LookupField and MultilistField. So if you have multiple tags it should render all of them. Commented May 24, 2018 at 13:20
  • I used this to render Department tags in search results. Worked like a charm! Commented Apr 5, 2019 at 20:43
  • If we have multiple tags available on different items and using the referenced variant it is giving duplicate tags because the same tag is being used in the same field for different items. Commented Sep 13, 2022 at 13:53

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.