Friday, December 9, 2011

Customize Blog Posts in SharePoint 2010 Blog Site Template


If you are using the out of the box SharePoint blog site and you want to customize the layout of the blog posts, this is how you do it.  This requires you to create a new XSL template file and then connect that file to the blog post.

This example shows how we remove “By” section of the blog post shown in the figure below.



1. Locate the blog.xsl file on your SharePoint server. It is located in:
          C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL

2. Get a copy of it and rename the copy. (Ex: CustomBlog.xsl). Make sure CustomBlog.xsl is saved in the same directory as blog.xsl.

3. Modify CustomBlog.xsl. You have to find respective statement for the by line and remove it. The statement of my file was:
  <xsl:when test="@Name='Author'">
    <span class="ms-postfootercolor">
      <xsl:value-of select="$thisNode/../@resource.wss.ByPrefix"/>
    span>
    <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&nbsp;xsl:text>
    <xsl:value-of select="$thisNode/@Author.span" disable-output-escaping="yes" />
  xsl:when>


4. Go to the Blog home page (http://<blog>/default.aspx), then Site Actions –> Edit Page.
Select Edit Web Part option of the Posts Web Part.



5. Expand “Miscellaneous” section of the edit web part properties window. Specify “/_layouts/xsl/CustomBlog.xsl” as the XSL Link. Save properties.


 
6. Save changes and refresh the page. You will find “by” section is removed from the blog post as shown in the below figure.


8 comments:

Rajesh said...

Great!! How we can able to do this changes using visual studio without editing blog pages using SP designer

Staygreen Academy said...

I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for.
SharePoint Online Training

Unknown said...

Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
SharePoint Consulting

Unknown said...

is there options to change the date positions: Month in PostDateTopBox and Date in PostDateBottomBox

Anonymous said...

Thanks, how do you do this in Office 265/SharePoint Online?

Bassam Infotech said...

Hey such a wonderful post thank you

Anonymous said...

This post was really brilliant and helpful for people. I would like to recommend a SharePoint consulting company for all your sharepoint related queries and needs. Visit: http://aufait.in/sharepoint

Lagetha said...

I loved reading this blog. We would like to offer any sharepoint related services for your business needs.