CSWP Discussion Display Template

This is a downloadable display template that you install on your site collection to allow any Content Search Web Part (CSWP) to display discussion board posts with an icon, description, # of replies and last replied.
Compared to the CSWP simple discussion format, this display template adds a hover affect, the ability to have 4 field references instead of 3, and eliminates the need to add a script editor with a link reference to each page the CSWP is on.

Adding Discussion Display Template to Site Collection

You must have manage hierarchy permissions or higher on the site collection home in order to upload new display templates.

1. Download and extract the 3 files from the zip file:

Upload the CSS file and icon

2. Add the CSS file and Icon to the Style Library at the Site Collection top site.

3. If there are the green checked out icons next to the files, click the checkbox next to the 2 files, select the Files tab, and Check In the 2 files.

4. Select Major version if presented with an option, click OK.

Upload the display template

5. Go to the Site Collection Site Settings, select the Master pages and page layouts option.

6. Click on the Display Templates folder

7. Click on the Content Web Parts folder

8. Click on the Files tab, select Upload Document

9. Click the Browse button

10. Find and select the Item_custom_discussions HTML file that you extracted in Step 1.

11. The file properties window should popup, the Content Type, Title, Description, etc should all be pre-filled so just select Save.

12. Click the checkbox next to the Item_custom_discussions.html file, click on the File tab, Check In (if option if available), then Publish (if option is available).

Add and configure the CSWP on a page

13. Go to a page and edit the page, Insert a Content Rollup > Content Search Web Part onto the page.  Edit the web part.

14. Click the Change query button.

15. Click the Switch to Advanced Mode option.

16. Edit the Query text, your query text should include the path to one or more sites or discussion lists, if you have multiple enclose the paths in brackets and separate with OR statements.  Append SPContentType=Discussion to the end of the Query Text.

17. Click the Sorting tab, Sort by Created Descending.  Click the OK button at the bottom to save your query.

18. Select how many items you want to display, select the Custom Discussions Item display template, click OK to save the web part settings.

Your CSWP should now be displaying discussions with the custom formatting:

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

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: