Recent

Create a Content Search web part Display Template

You can either upload an existing Content Search Web Part (CSWP) template to your Site Collection or you can create your own CSWP display template.  Although you can use other tools to create and edit the display template, SharePoint Designer (SPD) is probably the tool that works best.

Create a custom CSWP Display Template

1. Open the Site Collection parent site (This is where the Master pages and page layouts library is located) using SPD.
cswp-ex-14

2. Click on the Pin icon next to All Files, expand _catalogs, masterpage (Master Page Gallery), Display Templates, Content Web Parts.cswp-ex-7

3.  Start with an existing template, If I want an image in my display template I usually use the Item_Picture3Lines.html template.  Right click on the HTML file, select Copy.
cswp-ex-8

4. Right Click next to the file, select Paste.
cswp-ex-10

5. Down at the bottom of Content Web Part items you should now see a new copy of the HTML file that you copied.
cswp-ex-11

6. Rename the file (no spaces in file name), then Check Out the file, and select to Edit File in Advanced Mode.  If you get any errors during this process, just try renaming or checking the file out again.  Sometimes you have to do try a couple of times before it will work.
cswp-ex-12

7. Change the Title for file, the Title is what appears in the CSWP web part Display Template Item dropdown menu.
cswp-ex-13

8.  Make your changes to the CSWP file, then Save the file.

9.  Right click on the HTML file, select Check In, select Publish a major version and OK.
cswp-ex-15

Now for any CSWP added to any of the sites in that site collection, you will see your new custom display template (Custom Discussions in this example).
cswp-ex-6

About Nick Hurst (84 Articles)
SharePoint and Nintex developer who strives to find easy to deploy and maintain solutions for business problems.

1 Comment on Create a Content Search web part Display Template

  1. Ihave followed exactely your tutorial but my custom display template is not shown in the CSWP display template liste
    I’m looking for solution for 2 weeks but no solution
    thanks for help

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: