Tuesday, September 1, 2009

Grouping Articles By Month

After creating a blog site I wanted to show a webpart that grouped the posts by month. To accomplish this I added a calculated field to my Posts list and used the following formula:

 =TEXT(Published,"yyyy - ")&TEXT(Published,"mm")&TEXT(Published," (mmmm")&TEXT(Published," yyyy)")

 


 
 
 
 
 
 
   
 



 
 
 
 
 
 
 
 
 
 
 


You can substitute Published for any other date field within your Posts list. When calculated it displays the date in the following format "2007 - 05 (May 2007)"

After completing the calculated field I added a new Posts webpart to the page. I then modified it to the show the "All Posts" view. Then I modified that view to group by the calculated field I created.

Note: It is important to change the view of the webpart to from "" to "All Items" after you add the webpart. Otherwise when you uncollapse the grouping the titles and other text will have the same formatting as the blog posts. This means your titles will show up HUGE.

No comments: