3

I am having problems preparing my own display template for the Content By Search WebPart running queries on a wiki page library - so far I have been successfull in displaying the title, author and the decoded html preview of the wiki page item, however I cannot seem to find a way to display the Enterprise Keywords.

I would like to show them as a comma-separated text line, i.e.

Keywords: keyword1, keyword2, keyword3

If I understand it correctly, I should get the Managed Metadata Property name: Keywords ...and add it to the display template, the same way I add other properties:

<mso:ManagedPropertyMapping msdt:dt="string">'Picture URL'{Picture URL}:'PublishingImage;PictureURL;PictureThumbnailURL','Link URL'{Link URL}:'Path','Line 1'{Line 1}:'Title','Line 2'{Line 2}:'Author','Line 3'{Line 3}:'WikiFieldOWSMTXT','SecondaryFileExtension','ContentTypeId'</mso:ManagedPropertyMapping>

In my case I'd like to display it instead of displaying the Author (which displays fine), however that just causes SharePoint to display nothing in that place. I realise I have to do something else on the property to have it displayed like I want to but have no idea what.

Here's how the html part looks like, which works fine for Author but not Keywords:

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

Please advise.

Edit* After attaching a console.log(line2) command to the javascript part, I get a property which is already empty, according to SharePoint: chrome's console log What could be the reason?

0

Well, turns out I was using the wrong managed property - the actual property responsible for the enterprise keyword was called Tags: Tags Have to be more careful next time.

Edit==> No, tags returns keywords and managed properties ! you can test that by adding a new managed property and the result will be combined between keywords and that property !

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.