1

I have a list library that contain two columns:

  • Title: Single line of text field type
  • Body: Multiple lines of text field type

I am experiencing a problem related to the way search results from the list are begin displayed: basically, when searching on any content inside the body field, the search result display the content of the field as HTML code, so I am getting something like

<div class="ExternalClass06285CF4FB8D45FE87B277D1A95B051E"> content goes here .... 

Can anyone help me to solve this issue on my search center result web application ?

2
  • Would you like to display it as plain text or as html? Jun 18, 2015 at 15:19
  • I need to display the content as text and don't show the <div or the HTML code
    – HaSS
    Jun 24, 2015 at 14:00

1 Answer 1

0

Assuming you have jQuery, you could do something like this in your display template:

jQuery(STSHtmlDecode(ctx.CurrentItem.yourprop)).text()
2
  • Can you give us more details about the above function and where I can add this script on the search result page ".../searchcenter/results.aspx" or on my master page ?
    – HaSS
    Jun 25, 2015 at 6:18
  • STSHtmlDecode is a utility function available from one of the search .js files from SharePoint. And you need to edit the display template for the item you are displaying. I have a sample doing something similar at techmikael.blogspot.no/2014/02/… Jun 25, 2015 at 10:28

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.