I have added a column with content of type "Hyperlink or Picture" to some of our lists of a particular content type (SharePoint 2013 on premises). In the lists the data is being displayed pretty as a hyperlink with a nice display name.

I am using a content search webpart to aggregate these lists as a feed. Now I would like to show the new managed property (BuildOWSURLH) in this feed. But when I add it, a terrible, long URL is being displayed. It is not even clickable. I just want it to look as pretty as in the original lists. What javascript processing is required in the display template to preserve the nice hyperlink from the original lists?

If there is no easy solution for this with "content search", and there is a solution with "search", I have no problem switching to search.

SharePoint list with two items at the top and below is the display template where I have masked parts of the URL

  • I tried the same on a content search web part and it was displaying the URL I added in the list item. What long URL are you seeing? Can you post a screenshot of your list item and what you are seeing on CSWP? Jan 28, 2016 at 18:28
  • I have updated the post with a screenshot showing two items in the original list at the top and the same items below displayed using a simple display template. I have masked parts of the long URL.
    – Gunilla
    Jan 29, 2016 at 8:02
  • I have also added console.log(ctx.CurrentItem) to the display template (a simple template with just lines, based on Item_TwoLines.html), and it is actually writing that it is converting the value. The URL part is intact, but the display name is lost. [tryParseValue][Value parser converted value for Prop[BuildOWSURLH]: InputValue[xxx/tfs/xxx/_build#buildUri=xxx:///Build/Build/…, Build Summary]:ParsedValue[xxx/tfs/xxx/_build#buildUri=xxx:///Build/Build/… I have no idea what to do about this, I am a beginner with javascript and display templates.
    – Gunilla
    Jan 29, 2016 at 8:06

1 Answer 1


I see the same behavior in my environment - if I have a hyperlink field, search seems to return the link but not the description.

The easiest way to approach this I think is to create a new display template. Copy the Item_TwoLines.html that resides in your Master Page Gallery > Display Templates > Content Web Parts.

Be sure to change the <title> attribute at the top from "Two lines" to something you recognize, because this is the value you see in the drop down when configuring your CSWP and choosing a new display template.

Since it looks like you want the clickable link to say "Build Summary", I would simply change my code from this:

<div class="cbs-Line2 ms-noWrap" title="_#= $htmlEncode(line2.defaultValueRenderer(line2)) =#_" id="_#= line2Id =#_">
_#= line2 =#_

to look like this:

<div class="cbs-Line2 ms-noWrap" title="_#= $htmlEncode(line2.defaultValueRenderer(line2)) =#_" id="_#= line2Id =#_">
<a href="_#= line2 =#_">Build Summary</a>
  • Thanks! I found out that Sharepoint also ruined the &_ in the URI part (it changed #buildUri=xxx:///Build/Build/36311&_a=summary to #buildUri=xxx:///Build/Build/36311&amp;_a=summary) so that the link was pointing to the wrong location. Anyway, I added <a href="#= STSHtmlDecode(line4.value) =#">Build Summary</a> and that seemed to fix the issue.
    – Gunilla
    Feb 3, 2016 at 9:52

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.