Does anyone know exactly how the fallback works on rendering variants in SXA? I was checking the default variant of the navigation, and I can see:

  • Navigation title
    • Title
    • __Display name

I assumed that the navigation title is used if present. Which seems to be correct. And I think it fallbacks to title as that is it's child.. which also seems to work. But what is the display name doing there? Based on the item definitions I would expect the display name to be rendered after the title in case we have no navigation title.. but that is not the case. I see in the rendered html that the display name is rendered as title-attribute of the link on my title (or navigation title).

So, why is it rendering this way?

1 Answer 1


Nesting will have different behavior, depending on which variant field you select. The most popular field used to wrap something is Section

For VariantField if you nest another VariantField it will work like a fallback for the parent.

If parent field is empty then first child will be taken as a fallback value. If first child is also missing, then second and so on.

  • Variant Definition
    • VariantField1
      • VariantField2 - first fallback for VariantField1
      • VariantField3 - second fallback for VariantField1 (if VariantField2 empty)

So nested variant fields are used to define fallback values only.

Why you see Display name as a title attribute?

Because it is hard-coded in code RenderRenderingVariantFieldProcessor.cs

CreateHyperLink call

if (customField is FileField)
    FileField fileField = item.Fields[linkFieldName];
    string fileUrl = fileField.MediaItem != null ? MediaManager.GetMediaUrl(fileField.MediaItem) : string.Empty;
    return CreateHyperLink(fileUrl, item.DisplayName, isDownloadLink, attributes);


protected virtual HyperLink CreateHyperLink(string href, string title, bool isDownloadLink, NameValueCollection attributes)
    HyperLink hpl = new HyperLink();
    hpl.Attributes["title"] = title;


If this is a huge problem, you can fix it.

  1. Create derived type of Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderVariantField class
  2. Override CreateHyperLink method with your logic
  3. Replace old implementation with your by patching configuration file




<processor type="Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderVariantField, Sitecore.XA.Foundation.RenderingVariants" patch:source="Sitecore.XA.Foundation.RenderingVariants.config"/>`
  • Ah, ok.. it's the hard-coded part that got me confused. Didn't expect anything in sxa to be hard-coded :) But so it's actually working as I expected.
    – Gatogordo
    Commented May 22, 2017 at 17:16
  • Well, I wouldn't say it's hard coded - we just defined such attribute value. But in SXA you can override everything:) Commented May 22, 2017 at 17:22

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.