Skip to main content
6 votes
Accepted

PDF Files not opening when clicked from the content search web part

In SharePoint Online the best way to achieve opening of documents in the browser is by appending web=1 as a query string parameter to the file URL like https://tenant.sharepoint.com/Documents/file....
Gautam Sheth's user avatar
  • 30.9k
5 votes

assign href of anchor tag in javascript in display template

In the display template make the following change: var listItemID = ctx.CurrentItem.ListItemID; //change as per your ID var blogUrl = "/sites/Pages/BlogDetail.aspx?ID="; var viewBlogUrl = blogUrl + ...
Gautam Sheth's user avatar
  • 30.9k
5 votes
Accepted

Is there any drawback if i created a duplicate new Managed Property inside my Search Service which have a user friendly Title

Your approach is valid. Creating duplicate managed properties : 1) does not affect performance, it does not slow down search 2) it will not result in duplicate search results. There is no harm or ...
Gautam Sheth's user avatar
  • 30.9k
4 votes

In a search display template, is there a search property available for the actual text (k=...) in Srch.U or any of the search objects?

You can retrieve it from the DataProvider object. Which is accessible from within your display template. ctx.DataProvider.get_currentQueryState() This returns an object which gives you the whole ...
Elio Struyf's user avatar
  • 1,693
4 votes
Accepted

How to reference JavaScript file from web application root from display template

It can be achieve different ways. Quick way is combination of default JavaScript object and SharePoint page variable. var url = window.location.protocol + "//" + window.location.host + ...
asim nadeem's user avatar
4 votes
Accepted

How to change hover panel position

You should be able to override the element using some CSS. However, as the style is inside the HTML you would need to use the !important parameter to override the inline style. .ms-srch-hover-...
Christoffer's user avatar
  • 9,796
4 votes
Accepted

Display Template - link blog post comment to related blog post

Comments list stores PostTitle which in turn contains both ID and Title for the Post. In the ViewComments.aspx page, you can use REST api to create a link to the related Post. var listname = '...
Aveenav's user avatar
  • 4,201
3 votes
Accepted

Unable to use $getItemValue for a field not defined inside the properties mapping , inside Display Templete

Try add yourCommentOWSMTXT at first place <mso:ManagedPropertyMapping msdt:dt="string">'CommentOWSMTXT','ListID','ListItemID', ... then save item.html display template. Go to your page where ...
Marko Tica's user avatar
  • 2,537
3 votes
Accepted

Display template js file not created while deploying the custom display template via visual studio in Sharepoint 2013?

Write your module code as below. Important thing to note is to keep the level as Draft: <Module Name="_catalogs" Url="_catalogs/masterpage/Display Templates/Search"> <File Path="...
Gautam Sheth's user avatar
  • 30.9k
3 votes
Accepted

Sharepoint Online Display Template Custom Form Not Found by jQuery?

SharePoint already contains a form tag on the page, so it will strip out yours. You can try to replace your form tag with a DIV and do your serialize call as follows: var queryString = $('#DocNumForm ...
Elio Struyf's user avatar
  • 1,693
3 votes
Accepted

Missing property sync link in result types

It is old question but someone may still benefit from this answer. The link to update is: javascript:SyncProperties(). You could try to execute it from the console(F12 in browser). It worked for me (...
Marek Sarad's user avatar
  • 3,540
3 votes

Display Template - link blog post comment to related blog post

By default there is no managed property for comments' parent PostId and PostTitle, thus they're not retrievable via search. You have to manually create a managed property "PostId" and map the crawled ...
Heinrich Ulbricht's user avatar
3 votes

Images inside my Search Result web part will have their names = DispForm.aspx

You need to make sure that the item is being handled as a specific file type rather than as a list item in a library. There are specific instructions here, but basically: Go to Central Admin > ...
Graham's user avatar
  • 1,163
3 votes

SharePoint display template not showing in site

Whenever we create any display template we required two of the operation to be performed. Check-In the template Publish the template as Major version It seems that you have already Check-In the ...
Aakash Maurya's user avatar
3 votes
Accepted

display List/library url in display template

You can use the OOTB managed property ParentLink which will have the URL of the list or document library. In the <mso:ManagedPropertyMapping section of display template, add the ParentLink managed ...
Gautam Sheth's user avatar
  • 30.9k
3 votes
Accepted

Search Display Templates - How to display hover panel on click rather than on hover

Hi Martin, I have achieve your requirement , please change Event onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" to onclick="_#= ctx.currentItem_ShowHoverPanelCallback =#_" in your ...
Bhavik Shingala's user avatar
2 votes

What is the best practice to clone the default search result display template?

That #=ctx.RenderBody(ctx)=# just renders Item_CommonItem_Body.html So the idea is that you have some common managed properties you want to show for all search result types and you add those in ...
malexandrum's user avatar
2 votes
Accepted

Get system name and label from term in Display Template

Assuming you only want to parse the returned term and not lookup alternate labels and such you can use the built-in $getItemValue function. It takes the context and the mapped name of your managed ...
Thomas's user avatar
  • 980
2 votes
Accepted

What is easiest way to custom display templates in SharePoint 2013 Search

To create a custom display template, the best approach is to copy an existing one from Out-Of-Box display templates. With this, you can't overwrite the original one. To reach the display templates ...
Waqas Sarwar MVP's user avatar
  • 56.9k
2 votes

'Search on Yammer' link in search center refiners

I used css to hide it, that seemed to work okay but I am sure there are better solutions out there. h2.ms-displayInline a.ms-ref-name{ display:none;} Best of luck.
Jbourgoin's user avatar
2 votes

Is there a library of example display templates?

Google Search for 'Pnp Display Templates' or SPCSR by Elio Struyf It is unknown what the future of Display Templates is going to be with all the new SharePoint Fx / SharePoint Framework / New ...
Danny '365CSI' Engelman's user avatar
2 votes
Accepted

SPO Display Template Hoverpanel Not Showing PDF Image

It's not an exact copy. Your ManagedPropertyMapping does not match. You need to add ServerRedirectedEmbedURL to it: 'ServerRedirectedEmbedURL':'ServerRedirectedEmbedURL'
wjervis's user avatar
  • 5,738
2 votes
Accepted

SPO How to Change the Hoverpanel in Item Display Template?

Should it be ctx.currentItem_HideHoverPanelCallback and not ctx.CurrentItem.csr_HideHoverPanelCallback? Compare your code with the following snippet: and use the function names (...
Aveenav's user avatar
  • 4,201
2 votes
Accepted

How to execute a JQuery selector after dom objects are rendered complete in a search display template

SharePoint provides a hook for this called AddPostRenderCallback. All you need to do is define it in your template. https://blogs.technet.microsoft.com/sharepoint_quick_reads/2013/08/01/sharepoint-...
Derek Gusoff's user avatar
  • 8,036
2 votes

The Enhanced rich text Description column is being displayed with all the HTML tags showing explicitly, when rendered inside a Content Search Webpart

I too faced a similar issue, to solve this i created a copy of the display template. In the display template, i added the below code: var desc = $getItemValue(ctx, "Description"); This gives me the ...
Gautam Sheth's user avatar
  • 30.9k
2 votes

Get custom properties like `Created` and `Description` in Display Templates of ContentBySearchWebPart

One other thing to check, if you are using result types to display items: Go to /_layouts/15/manageresulttypes.aspx?level=sitecol at the site collection level, and /_layouts/15/manageresulttypes.aspx?...
moonpatrol's user avatar
2 votes
Accepted

Search: Only show site URL for retrieved documennt

Yes, use the "SPWebUrl" managed metadata property to get the subsite url. In the display template instead of link url use above mentioned property.
Monica Jagani's user avatar
2 votes
Accepted

Is there a way to set JSLink for a Content Type?

Yes, you can attach a CSR script to a Content Type. Content Types have a JSLink property. Although it is not documented in the Content Type Definition Schema, it is documented in the SPContentType ...
Dylan Cristy's user avatar
  • 12.7k
2 votes

Unable to build a link for my discussions inside my Display Template if the Path contain ' or ""

linkURL.overrideValueRenderer($urlHtmlEncode); is a function processing your HTML, if you provide it incorrect HTML it will NOT fix it. When creating HTML and/or Links with JavaScript you have to ...
Danny '365CSI' Engelman's user avatar
2 votes

overrideValueRenderer($urlHtmlEncode) inside my Display templete does not have any effect

The overrideValueRenderer method will override value retrieved from the managed property. For example, if the value of managed property of type text has large number of characters , so it will get ...
Gautam Sheth's user avatar
  • 30.9k

Only top scored, non community-wiki answers of a minimum length are eligible