Hi,Â
I am looking for some assistance. I would like to use the Page Image field in a Item Display Template. I have created the managed property and called it PublishingPageImage. I have added it to <mso:ManagedPropertyMapping section of my Item_DisplayTemplate. It is then referenced in my html using a javascript variable var pubImage = $getItemValue(ctx, “PublishingPageImage”;) and finally referenced it in my DIV using _#= pubImage =#_
The problem is when everything renders on the page i get the following, instead of the image being renderedÂ
Text – <img alt=”” src=”/PublishingImages/2-150-insider-story.jpg” style=”BORDER:0px solid;” />Â
Can anyone suggest how I might go about using this field to render an image on a display template?
Please see attachments.Â
Thank you.
-Matt
Have you tried something like:
var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + “_customId_”);
var pictureURL = $getItemValue(ctx, “PublishingPageImage”);
var pictureId = encodedId + “picture”;
var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 468, 220, ctx.CurrentItem, “cbs-customClass”, “Your alt text”, pictureId);
…
               <a class=”” href=”_#= linkURL =#_” title=”_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_” id=”_#= pictureLinkId =#_”>
                   _#= pictureMarkup =#_
               </a>
_customId_ coming from where?