Sharepoint 2013 Search Custom Microsoft Word Display Template 

We want to include Last Modified date and author name is Search results. 

1.Open your Search Site in Sharepoint Designer.

2, Go to _catalogs/masterpages/Display templates/Search

3. Copy Item_Word.html and past it. rename new file as Item_Work_Custom

 

Image

 

4. Change top most title to Word Item Custom

5. Update  <doby> content with following content

<div id=”Item_Word”>
<!–#_
if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
var id = ctx.ClientControl.get_nextUniqueId();
var itemId = id + Srch.U.Ids.item;
var hoverId = id + Srch.U.Ids.hover;
var hoverUrl = “~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Word_HoverPanel.js”;
$setResultItem(itemId, ctx.CurrentItem);
ctx.CurrentItem.csr_Icon = Srch.U.getIconUrlByFileExtension(ctx.CurrentItem);
ctx.CurrentItem.csr_OpenApp = “word”;
ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
ctx.CurrentItem.csr_ShowLastModifiedTime = true;
ctx.CurrentItem.csr_ShowAuthors = true;
var modifiedDate = $getItemValue(ctx, “LastModifiedTime”);
modifiedDate.overrideValueRenderer($contentLineText);

_#–>
<div id=”_#= $htmlEncode(itemId) =#_” name=”Item” data-displaytemplate=”WordItem” class=”ms-srch-item” onmouseover=”_#= ctx.currentItem_ShowHoverPanelCallback =#_” onmouseout=”_#= ctx.currentItem_HideHoverPanelCallback =#_”>
_#=ctx.RenderBody(ctx)=#_
<div id=”_#= $htmlEncode(hoverId) =#_” class=”ms-srch-hover-outerContainer”></div>
<div><b>Last modified :</b> _#= modifiedDate=#_</div>
</div>
<!–#_
}
_#–>
</div>
Image

Advertisements