1

I'm using Sitecore 9.1.1 and SXA 1.8.1.

I'm trying to set href data attribute to a Variant section in a rendering variant.

I tried to override the RenderVariantField class as mentioned in the solution for this question and it worked and returned the correct value - but only when I use it inside a variant Field. However, when I use it inside a variant Section it returns nothing.

Any idea what I can add in order to read a data attribute inside a variant section?

enter image description here

1 Answer 1

1

If you override RenderVariantField it will indeed work for a variantfield. If you want this in a section, you need to look into Sitecore.XA.Foundation.RenderingVariants.Pipelines.RenderVariantField.RenderSection in the same <renderVariantField> pipeline.

You might want to check Setting css class in SXA variant from content item or https://ggullentops.blogspot.com/2018/10/using-tokens-in-sitecore-sxa-variant.html for some extra information about attributes on sections.

1
  • thanks a lot for your answer, this is exactly what i needed Commented Jul 2, 2019 at 12:14

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.