EndUserSharePoint.com: Can I trim blog posts like Wordpress does?
The question of the day comes from TP:
In Sharepoint 3.0… Blog Template… I’d like to have the various posts “trimmed” so that only a few lines are visible and followed by a “read more” [or similar]. It’s a basic feature in Wordpress. Is there a function for this in Sharepoint 3.0?
TP – I agree. This would be a nice feature. My blog here is run off of Wordpress and I use the ”read more” functionality. If you have a .NET developer, ASP guru or XSL wonder on your team, this seems like a relatively easy thing to accomplish, but it is not available out of the box.





Hi,
You could with help from Heather Solomons excelent guide: http://www.heathersolomon.com/blog/articles/customitemstyle.aspx
modify the item styles and use a Content Query web part on your site to show the blog post as you want them.
WP uses a regex to find it and truncate the post on the main page in the loop.
Chris – Good to hear from you. How can that regex be accessed… is it part of the blog template?
Hi Mark. It’s on line 106 of the post-template.php file.
It basically looks for it in the content of the post and if it finds it then truncates and returns the content.
preg_match(’//’, $content, $matches)
Chris – Yep, I know where it is in WordPress, but we’re looking for a solution using the SharePoint blog template. Have you played around with that template?
@Mark: It can for sure be done with some custom ASP.NET. I tried to do it with editing the view, adding an excerpt column, etc. but for the life of me couldn’t get it to work.
My premise was to create a column that would store an optional excerpt (WordPress has this as well) that would display the excerpt on the home page and not the full body content. I created the column, but I couldn’t get it into the view.
Hey guys has there been anymore on this ?
Dan – Not that I know of. I’m not an ASP.NET guy, so I haven’t even touched it. — Mark
I’m in development stage with a webpart (extends the OOB ContentByQueryWebpart) that does just this… after having trawled the net for a solution to this… I decided I had to do it myself.
The webpart adds custom properties to the Toolpart to allow you to specify the number of characters to truncate and the field you want to truncate. The tool of course cleanly truncates any HTML.
Other properties of the webpart are also exposed (ItemXSL, CommonViewFields, DataColumnRenames).
I have it functioning on my own sites currently and will be looking for some additional beta testers before releasing this is a webpart product.
If any of you are interested in beta testing let me know.
Liam – What’s the implementation process… does it have to be installed on the server or can it be imported directly into a page? — Mark
It does need to be installed into the GAC as it is implemented as a DLL. Once there of course you simply import this web part into the page instead of the standard Content Query Webpart. – Liam