Recent

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.
cswp-disptemp-discussion-20
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:
CustomDiscussionDispTemp.zip

Upload the CSS file and icon

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

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.
cswp-disptemp-discussion-3

4. Select Major version if presented with an option, click OK.
cswp-disptemp-discussion-4

Upload the display template

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

6. Click on the Display Templates folder
cswp-disptemp-discussion-6

7. Click on the Content Web Parts folder
cswp-disptemp-discussion-7

8. Click on the Files tab, select Upload Document
cswp-disptemp-discussion-8

9. Click the Browse button
cswp-disptemp-discussion-9

10. Find and select the Item_custom_discussions HTML file that you extracted in Step 1.
cswp-disptemp-discussion-10

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

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).
cswp-disptemp-discussion-12

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.
cswp-disptemp-discussion-14

14. Click the Change query button.
cswp-disptemp-discussion-15

15. Click the Switch to Advanced Mode option.
cswp-disptemp-discussion-16

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.
cswp-disptemp-discussion-17

17. Click the Sorting tab, Sort by Created Descending.  Click the OK button at the bottom to save your query.
cswp-disptemp-discussion-18

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

Your CSWP should now be displaying discussions with the custom formatting:
cswp-disptemp-discussion-20

About Nick Hurst (84 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:

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: