SharePoint Blogs / SharePoint University
SharePoint Blogs and SharePoint University - all in one place!
Need SharePoint Training? Attend a SharePoint Bootcamp!

Please delete cookies related to sharepointblogs.com and sharepointu.com to resolve login issues!

How-To: Aggregate Blog comments using the Content Query WebPart

Aggregating blog posts using a content query webpart is rather simple. Even if you want to display meaningful teasers to the posts, you can easily change the layout/XSL of the content query webpart by following these guidelines: http://blog.henryong.com/2008/06/15/how-to-customize-the-content-query-web-part-xsl-to-aggregate-blog-posts/. (However, be aware that unclosed HTML-Tags might arise with this solution - this can blow your page layout completely!)

However, how to aggregate blog comments? I haven't found a "standard" solution, as the comments are using an own list type that is not listed in the content query element types drop down.

The workaround I found is fairly simple:

  • Create a content query webpart that aggergates blog posts.
  • Make sure that everything is configured just as you will want it for the comments.
  • Export the webpart and open it in your favourite text editor.
  • Change the following:
    • <property name="ServerTemplate" type="string">302</property> (302 is the list type of blog comments, 301 is for blog posts)
    • <property name="Title" type="string">Newest comments</property> (optional, this will be the title of your webpart)
  • Import the changed webpart definition file and add the webpart to your page.
  • Et voila...

Please note:

  • You cannot change any of the webpart properties within the browser. Every attempt will result in losing the "ServerTemplate" configuration.
  • The link to the comment might not be what you want: It will show the list item details, completely decoupled from the blog post. I'll try to figure out how to create a better link that points to the blog post (something like  Lists/Posts/Post.aspx?ID=1#Comments
  • I have no clue what will happen if you update your SharePoint installation or migrate to another version of SharePoint (likely: it will stop working :))

Posted 01-06-2009 11:13 AM by mhofer1976

Comments

SP Links Week 2 2009 | Alpesh Nakar Blogs on SharePoint, Microsoft and that's IT wrote SP Links Week 2 2009 | Alpesh Nakar Blogs on SharePoint, Microsoft and that's IT
on 01-08-2009 12:58 PM

Pingback from  SP Links Week 2 2009 | Alpesh Nakar Blogs on SharePoint, Microsoft and that's IT

Chavi wrote re: How-To: Aggregate Blog comments using the Content Query WebPart
on 05-28-2009 1:11 PM

Were you able to find a way to display the actual blog post. Is there any way through the itemstyle that the Post Title and its URL can be displayed?

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
Need SharePoint Training? Attend a SharePoint Bootcamp!
Posts (c) their respective authors. Everything else (c) 2009 SharePoint Experts, Inc.