Monday, August 20, 2018

Content Search Web Part: Open Links in New Tab

Just a quick post on how to configure a Content Search Web Part to open links in a new tab. See steps below.

1. Using SharePoint Designer, copy an existing item display template in order to create your own custom item display template (Site Settings > Master pages and layouts > Display Templates > Content Web Parts). For my needs, I usually copy the Item_TwoLines.html file. NOTE: You only need to copy the HTML file, not the JavaScript file (.js file) associated with the HTML file.

2. Edit the properties of your copied HTML file and give it a unique Name, Title, and Description.

3. Using SharePoint Designer, check-out your new HTML file, and edit it. Find the line of code as shown below, and add target="_blank".

4. Save the file, check it in, and publish it.
5. Edit your Content Search Web Part. Under the 'Display Templates' section, select the title of your custom item display template in the Item drop-down menu, and select the OK button to save your web part configuration.

Links should now open in a new tab.

No comments:

Post a Comment