0

I have the following list:

enter image description here

type of my columns are regular column. I want Customize Display Template for Content By Search result Web Part (Link01 and Link02) but pictureLink, description, pictureLink and AbstractLink attribute return null, with following commands:

var pictureLink =$getItemValue(ctx, "PictureLink");

var description =$getItemValue(ctx, "Description");

var pictureLink =$getItemValue(ctx, "PictureLink");

var AbstractLink =$getItemValue(ctx, "PictureLink"); and so.

but with var Title =$getItemValue(ctx, "Title"); command, title return correct value.

how to Mapping input properties and getting their values in Item display template ?

2 Answers 2

2

When working with a Display Template you have to request Managed Properties from the Context of the current item. The general process is:

  1. Crawl content
  2. Map crawled properties to Managed Properties
  3. Crawl Content again
  4. Create a new Display Template (often by copying an existing template)
  5. Add a reference to your custom managed property in the display template to the ManagedPropertyMapping attribute
  6. Create a placeholder in the body of the display template for the managed property using syntax like:

    ctx.CurrentItem.MyManagedProperty

I wrote up a full walk through here: http://www.ableblue.com/blog/archive/2013/06/05/introduction-to-sharepoint-2013-display-templates/

There are other posts on my site for debugging as well as a link to my session video from SCP14 on Display Templates and Query Rules.

3
  • do not Map crawled properties to Managed Properties(Option 2),What can I do?
    – A-Dastani
    Jan 17, 2015 at 16:25
  • I don't understand your question. Jan 17, 2015 at 18:18
  • how to Map crawled properties to Managed Properties?
    – A-Dastani
    Jan 17, 2015 at 18:19
0

How to change the way search results are displayed in SharePoint Server 2013

about the naming conventions for automatically created crawled properties and managed properties (How to display values from custom managed properties in search results)

1
  • Link only answers are not how we like it here, please add more details to your answer to make it useful even if /when the links break Jan 17, 2015 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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