How to customize the Content Query Web Part XSL to aggregate blog posts

Ever wondered how to have the Content Query Web Part (CQWP) aggregate SharePoint blog posts from the SharePoint Blog site templates? Oh wait, that’s already possible. How about aggregating blog posts, customizing the XSL styling and being able to display the first 200 characters of the post as a preview?

Believe it or not, I couldn’t seem to find a single definitive blog post on how to do this so I’ve decided to write one up myself.

Step 1

Assuming you already have your Blog sites setup, add a Content Query Web Part to the page in which you’d like to have the posts aggregated onto. Configure the Web Part to your liking. It would look something like this:

Step 2

Using SharePoint Designer, check-out and open the ItemStyle.xsl Style Sheet from http://yourserver/Style Library/XSL Style Sheets/

Step 3

Follow all the steps in this blog post. It will give you a good overview on how to customize the Content Query Web Part to aggregate and display News Article items along with the quick summary display and some other item properties.

Unfortunately, if you check this in, publish it and look at your CQWP, it won’t display the summary text of the blog post. It will look something like this:

So after much head scratching and googling, I came across this blog post and this blog post that gave me some hints as to why this doesn’t work with the Body field of SharePoint blog posts. Apparently the Blog Site template and the Posts Document Library contain more than one Content Types (one for posts, one for comments?). But wait! He says we can override the Content Query Web Part. Unfortunately… there doesn’t seem to be an available BaseType for blogs.

63 comments

this is god send..I was looking for this to post blogs on my MOSS 2007 front page dynamically for the portal from the SharePoint blogs. I just have to look into a way to put one and only the latest post on the content query webpart. i should be able to maniupalate this…
thanks again.

I get this error when I check in the itemstyle.xsl with your template.
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor suc

You need to replace any punctuation from the copy-paste with real ‘”‘, ”’, and ‘…’ chars…

Caught me out too…

My problem is, if I do step 4 with the ListOverride, the Web Part does not display *anything* (I will check to see if the GUID shown here is a sample…), but if I take it out, I still get no body synopsis…

Hey Henry
After banging my head with table for 3 days (heather article is not that easy to follow ) i find your article which is exactly i need
thanks for the article .but infact when i copy and paste code i get “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor suc” Please help i will really appreciate any assistance in this mater .
Thanks

Hey man …the override with the list ID’s just doesnt work. I cannot even import the webpart with the list id. I realize you have tow list ID’s beause one is for the posts and other for the comments (How did you even get this list id). any help is appreciated.

Works great… BUT… the truncating of the Blog body field does not unfortunately leave “valid HTML”… with the result that if your blog posts contain any html formatting this will then “leak” out into the rest of the page.

I wish there were a way to access the functionality for the “summary view” for the list view web part. That somehow magically truncates any rich text – without any “leaking” problems.

I was wondering if it capable of seekingout all blogs on the server, or maybe the latest 20 posts from 20 different blogs automaticlly with out having to add the blogs to the web part..

What we are trying to do is have a blog aggregator that dynamiclly finds blogs created by staff and displays their posts in the aggregator rather than the sharepoint admins having to add a new blog everytime a new one is created.

ya Dan, you just point the Query Source to show all sites in the site collection, or if you want a specific site set it to show items from the following site and all subsites and browse to the level you want.

I’ve tried following the directions you’ve posted a bunch of times. Starting from scratch, reviewing and what not. I cannot for the life of me get the body of the blog posts to show up in the query. I get the title, date, author and the “…” link, but just no body of the blog post. It’s been quite frustrating so ANY insight to this would be very appreciated.

Ok, I did end up getting this to work. With a combination of the other replies assistance.

I really am a newb when it comes to modifying the itemstyles, but I noticed, even in the example images posted above that the entries slowly indent as the number of blogs grows. I’m happy as hell that I finally got the posts to show, but if someone could help with some of the aesthetics I would be grateful!

I have tried what feels to be endless solutions to get this body text to display. I am at a complete loss as to why the value is not selected and displayed. Does anyone have some definitive answer as to how to get it to show up aside from the snippets in the comments?

Can someone please help me out with this. I’m getting all the way to step 4. My webpart will not display the teaser text for each of the blog entries. From reading all the replies I’m not really sure what to do at this point. People have said “I finally got it to work” but didn’t say what they are doing. Please help!

For those of you who still haven’t gotten this to work, try deleting the custom web part on your page and re-adding… For whatever reason, I had two of the same custom web part in my webpart gallery. I’m pretty sure I always had ‘Overwrite existing files’ checked when re-uploading.

I tried all the stuff mentioned by you but failed at the Step-3. I tried replacing the “”‘ … ‘””(Copy paste) with “”‘ … ‘”” (manual written) but i am not able to resolve the issue.

Everytime i try doing some changes mentioned in the blog i landup with the erorr message…
“Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator”

Building backlinks is most important part of SEO. Web Directory submission can help webmaster to promote their websites by building backlinks, increasing exposure and traffic. Link Builder is a link building resource. You can list your website on search engine friendly and article directories to use as site promotion tools.

I drop a leave a response when I especially enjoy
a post on a site or if I have something to valuable to contribute to the discussion.
It’s caused by the fire displayed in the article I browsed.
And on this post How to customize the Content
Query Web Part XSL to aggregate blog posts | The SharePoint Swiss Army
Knife. I was excited enough to drop a thought ;
-) I do have some questions for you if it’s okay. Is it only me or
do a few of these responses look like left by
brain dead people? 😛 And, if you are writing at other social
sites, I’d like to keep up with you. Could you
make a list the complete urls of your community sites like your twitter
feed, Facebook page or linkedin profile?

First of all I would like to say superb blog! I had a
quick question that I’d like to ask if you do
not mind. I was curious to know how you center yourself and clear your mind prior to writing.
I’ve had a hard time clearing my thoughts in getting my thoughts out there.
I truly do enjoy writing however it just seems like the first 10 to
15 minutes are wasted simply just trying to figure out how to begin.
Any suggestions or tips? Kudos!

You will discover other beneficial rewards of listing a business on an internet enterprise web-site directory. As a result of advertising is often expensive for any business enterprise, substantial or small, listing with an online small business directory is really a expense efficient approach to publicize your enterprise. Listing can be relatively inexpensive, oftentimes about $5.00 to $10.00 a year. When listing within a conventional paper directory, after it is printed and distributed, it can’t be changed. A web based business directory allows you to modify and update your listing at any time.

Prior to deciding the package for low-priced hosting, it is actually smart to make an substantial search, as outlined by your requirements, their reputation, customer service, fees, and rules. If you expand the company they should really have the solution of expanding the hosting space or you need to switch more than to private server, as your business expands.

I know this if off topic but I’m looking into starting my own blog and
was curious what all is needed to get setup? I’m assuming having a blog
like yours would cost a pretty penny? I’m not very internet smart so I’m not 100% positive.
Any tips or advice would be greatly appreciated. Many thanks