1

This is my first attempted to alter a display template so please bear with me, I am not a developer but I believe I have obtained most of what I need to know. To start off I have a custom list.

Title - Single Line of text Doc-Description (SORRY Very BAD COLUMN NAME this is a list) - Rich Text field ( I filled this out and used a bulleted list)

  • Did a full Crawl
  • Added A managed Property Doc-Description which maps to my crawled Property ows-DocDescription
  • Did a Full Crawl
  • Used SharePoint Search Query Tool and Verified I can pull the one item in the list and the Doc-Description is populated but with plan text (Crammed all my text together from the list)
  • Copied the Picture3Lines.html Item display template
  • Renamed it to Custom_Picture3Lines.html
  • Assigned my Content Search part to use this template under Item.
  • Under content I am using the list display template.
  • Used _#= STSHtmlDecode(line3.value) =#_ in the html on line 3 and it only displays the text with no HTML added to it. I have tried every variation I can find in every blog and I still just get the plan text with no html. Here is what I currently have.

Line 3 is assigned to display Doc-Description.

Here is the code from the HTML.

<div id="_#= line3Id =#_" >_#= STSHtmlDecode(line3.value) =#_</div>

Any Help would be greatly appreciated.

1

Rich Text fields cannot keep their formatting; only Full HTML fields keep their formatting in the Search Index.

This is non-intuitive because exporting a regular list and using the template on a parent/child site will still keep the formatting for Rich Text fields, so you'd expect that same behavior when performing Content Search. Unfortunately, that's not the case. Make a new site column as Full HTML, try throwing a bullet in there, and see if that bullet gets displayed properly. Assuming it does, open up your list using Access, copy over all the data from the Rich Text field to the Full HTML field, then clean up your list: delete the old column, rename the new column, check that your managed property names are OK in the Display Template, and edit any views that you had on the list.

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.