3

The SXA search results tool-tip contains the display name of the item as shown in image below enter image description here

I want to make the tool-tip reads its content from a specific field of the item template, as I have a rendering variant that contains many fields of different templates.

1 Answer 1

3

Search Results rendering is using Rendering Variants to display results. If you want to modify how HTML of particular search results item is generated then you would need to override Rendering Variants logic (that might be pretty hard). We are using Field Renderers (Sitecore is generating HTML) there like that:

FieldRenderer fieldRender = new FieldRenderer
{
    Item = item,
    FieldName = variantField.FieldName,
    ...
};

This HTML is later on put on the fronted into <ul><li> list. And as far as I can see in the code we are not adding any tooltips there. So the tooltip comes from Field Renderer probably.

Beside all above you can try use Rendering Variant tokens:

enter image description here

2
  • Thank you so much, the second method worked, but I wrote title instead of tooltip, when I wrote tooltip it didn't work, Can you please tell me the difference
    – user4076
    Aug 2, 2018 at 15:58
  • The syntax is $(FIELD_NAME). When you will replace FIELD_NAME with "Title" then text from Title field will be taken. When you will put there different field name than different value will be taken (of course that field must exist on the item). Aug 2, 2018 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.