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 ?

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

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

jQuery(STSHtmlDecode(ctx.CurrentItem.yourprop)).text()
  • 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 '15 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/… – Mikael Svenson Jun 25 '15 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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