Skip to main content

Click Mice, Unclick Mice

Go Search
Home
Wikin
Windows Live ID Authentication
  

Click Mice, Unclick Mice > Posts > What is Missing in the SharePoint Blog Template (pt.1)

 Posts

What is Missing in the SharePoint Blog Template (pt.1)
I had created the Wikin site template to overcome some of the perceived shortcomings of the out of the box SharePoint Wiki site template.  I made it in to an STP because there were a couple of people who wanted something easy to deploy on their SharePoint farms.  I have decided that I have a much more personal investment in looking at the out of the box Blog template.
 
Recently, I have been looking around and checking what the general feel for the SharePoint Wiki and Blog functionality is.  I have to say, in general the feedback wasn't positive, at least what I read.  As I read more and thought about it, the core issue was that SharePoint is really a development platform.  Granted, Microsoft will have some feature functionality that completes all your hopes and dreams, but what it doesn't give you on a platter you can create from the platform.
 
So we get to the point, since I am blogging I want what other blog software has.  I mean, who doesn't want what the other guy has, right?  I am willing to invest a little time to get what I want.  So this is part one in an open ended number of posts that will work to create new blog functionality from the building blocks of the platform without custom code.
 
Series Links
 
Proper Archive Links
The frst thing I notice that just seems missing is a proper set of Archive links.  I mean, don't get me wrong, there is a link out of the box, but where is the elegance in a link to the "All Items" view?  So the first problem is how to make this happen.  It shouldn't be too big of a deal, lets break it down to what I need:
  1. Navigation component that shows the Month and Year with the number of posts for that timeframe
  2. Let's make the navigation component expandable so it can show links to the posts if people choose to expand it
  3. Should appear on every page in the same position
  4. Should adhere to the theme that is on the page at the time (i.e. if I change themes it should update to reflect that)
  5. If I click on the Month Year heading it should display a filtered list of the posts for that month

This is a really long post, so for those of you that are impatient you can find the finished product here.

Making it Happen

Since we are doing this with the mantra of no custom code, that gives me two choices for how to make this happen: the List View web part and Data View web part.  List View is too restrictive so I am going to punt on that and we'll do this as a Data View.

Section 1 - Configure And Convert A List View

The first step is to load up the site in SharePoint Designer.  It happens to be my favorite editor for this kind of thing, and so that is what I'll be using.  Now once Designer is open, I am going to add a Posts list view web part.  I can feel you scratching your head, wondering if I remember that about a paragraph ago I was going to use a Data View.  I am, but the SharePoint Designer team has done a lot for me already in terms the #4 requirement on the theme.  If I convert the List View web part to a Data View, it will keep the CSS settings of the List View.  On the other hand, if I start from a fresh Data View I have to go through and setup the proper table and CSS structure to get everything to look consistent.  So the next step is to get the List View showing what I want.  In this case, it is the Title column grouped by the Posting Date.  To do this I will:

  1. Bring up the context menu and select the Fields option (Fig 1.1). 
  2. Setup the columns to the Title field I would like (Fig 1.2).  
  3. Bring up the context menu and select the Change Layout option (Fig 1.3). 
  4. Setup the List View options I would like (Fig 1.4)
  5. Bring up the context menu and select the Sort and Group option (Fig 1.5). 
  6. Setup the columns to the Sort order and Group by properties I would like (Fig 1.6)
  7. Right-click the List View and convert to a Data View (Fig 1.7).

That is as close as I am going to get with the List View. 

Figure 1.1
Figure 1.2
Figure 1.1
Figure 1.2

Figure 1.3
Figure 1.4
Figure 1.3

Figure 1.4

Figure 1.5
Figure 1.6
Figure 1.5
Figure 1.6

Figure 1.7
Figure 1.7

Section 2 - Modify The Data View Look And Feel

Now we have ourselves a Data View that is close, but still pretty far away from what we want.  We have our view set to group by posting date, but not by month and year yet.  So it is time to get our hands dirty with the Data View. 

  1. The easiest way to work is through the design surface so we start by right clicking next to the Title  column header and selecting Delete -> Delete Rows (which is not needed since we are going to be doing a lot of grouping and things really should already be sorted by published date) (Fig 2.1)
  2. We need to change the Group Heading for our published dates.  We can't have it saying Published: MM/DD/YYYY that just won't do.  Click on the first Published xsl:value-of element and just press delete 6 times (this is going to delete the Published column title text and the colon leaving us with just the date).
  3. We are close to where we want to be now; all that we are missing is a count of the grouped items.  Luckily, this one is easy.  We will just click on the date in the design surface, which will highlight a portion of the Code View.  Then we'll paste in (<xsl:value-of select="count($nodeset/@Title)" />) which will give us a count of the number of items passed in to the template (Fig 2.2)
  4. The last change that is required will give us the setup for requirement #5.  We will need to setup a custom view for this, but knowing ahead of time what we need allows us to plan for it.  Once again, we are going to click on the first date to get our place in the Code View.  Now we will paste in <a href="{concat(substring-before(@FileRef, '/Posts/'), '/Posts/By%20Month.aspx?Month=', $fieldvalue)}"> which will be our link to the custom view we will need to make.  Essentially, it is a view that will be in the Posts list and it will have a query string with the value of our Group Heading.  Now we close off the <a> tag at the end of the Group Heading (Fig 2.3).

 That completes our Look and Feel changes.

Figure 2.1
Figure 2.1
Figure 2.2
Figure 2.2
Figure 2.3
Figure 2.3

Section 3 - Change The DataSet

So now we have updated how the XSL template for each group heading is handled.  Next we need to get the data to actually be grouped properly.  By default our list view has automatically grouped our data by posting date.  So we just need to modify what it has done, to group by posting month and year instead.  There are three main areas we need to change. 

The first is the NewGroup_0 variable which we will track down by doing a Find for NewGroup_0.  The Code View should show the xsl:variable tag, and inside there is a xsl:when that contains a xsl:value-of tag.  This is our first taget.  This will start our group creation so we will need to change the select statment.  By default you will see it checking if the Published date has changed.  We'll alter the XSL to this ddwrt:NameChanged(ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'MMMM yyy'), 0) which checks to see if a formatted date string of the published date has changed (Fig 3.1)

The next target is the groupheader0 xsl:variable which is located just a few lines below the NewGroup_0 variable.  This one has a xsl:otherwise with a xsl:value-of tag.  This will set our group header text so this select statement will be changes to ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'MMMM yyy') which will set it to the formatted string we used when we changed the previous select statement (Fig 3.2)

Our last target is in the xsl:call-template for dvt_1.groupheader0 which is just below the groupheader0 variable.  There is a xsl:with-param with a name of nodeset that we need to change the select statement for.  We will change it to msxsl:node-set($dvt_Rows)/root//Row[((ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'MMMM yyyy'))=$groupheader0 or ((not(ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'MMMM yyyy')) or ddwrt:FormatDateTime(string(@PublishedDate), 1033, 'MMMM yyyy')='') and $groupheader0=' '))] which will select the data based on the formatted date string of its published date matching our group header (which is in Month Year format) (Fig 3.3).

Figure 3.1
Figure 3.1
Figure 3.2
Figure 3.2
Figure 3.3
Figure 3.3

Section 4 - Putting It Into Play

Well we actually have our Data View all setup now.  We can save it and it will have everything we were hoping for except #3, but getting it in to the navigation is the easy part.  Right?  One would think so; however, the Blog template has some special characteristics around how its pages work.  There is a new web part zone added to a few pages called the BlogNavigator so you have to actually export the web part and add it to these pages in their BlogNavigator web part zone:

  • default.aspx
  • Lists/Posts/Post.aspx
  • Lists/Categories/Category.aspx

After you have done this, you will need to open up the master page and add it there as well for all of the pages that are not listed above (assuming you want to).

Section 5 - Extra Credit

With any Data View web part there comes a problem: how can I make it reusable?  I am only aware of two ways.  Either make the Data View a part of an STP file, and it should automatically find its new list when the new site is provisioned, or make changes to bind to a list name instead of a GUID.  This will also find the new list in a provisioned site and has the benefit of being able to be exported and used on anyone's system without them having to edit it.  The instructions for how to make those changes are here.

Wrap Up

So while SharePoint might not have the capabilities of some Blog software out of the box, you can see that it is possible to use the raw materials to fashion what you need, and in a lot of cases I think you will find that you can do it without having to write and deploy code.  There are many ways to do things codelessly inside SharePoint.  We will take care of requirement #5 in What is Missing in the SharePoint Blog Template (pt. 2).

Comments

Great!

This is exactly what I have been looking for, thanks for the great post. I was wondering, I seem to get an error when I convert to Data View: The server returned a non-specific error when trying to get data from the data source...blah blah.

Any suggestions
Keith Bunge at 4/22/2008 11:50 PM

How?

How do you do this step: Now once Designer is open, I am going to add a Posts list view web part.
Keith Bunge at 4/22/2008 11:50 PM

The error I mentioned above

IT only happens when I have the list pre grouped/sorted.
Keith Bunge at 4/22/2008 11:50 PM

Re: Great!

Well generally when I have seen an error like that it was due to one of two things.  Either an IISRESET had just occured and I needed to try again and it would work the second time, or the data set that was being displayed was just too large and Designer was choking on it.  In the case of a large data set I generally just recreate the list on another site with less data in it or put in an ItemLimit while I am doing the conversion.
Keith Bunge at 4/22/2008 11:50 PM

Re: How?

In order to add a Posts list view web part just go in to the Task Panes menu and select the Web Part task pane.  Posts should show up as an option as long as you are on a Blog site.
Keith Bunge at 4/22/2008 11:50 PM

The error I mentioned above

IT only happens when I have the list pre grouped/sorted.
Keith Bunge at 4/22/2008 11:50 PM

Got it!

Thanks for the response, I figured it out, I had messed with some various things when tinkering around, I created a new site list and started from scratch and everything worked fine :)

Keith Bunge at 4/22/2008 11:50 PM

Again

I still have not been able to do this sucessfully, sorry to keep bothering you.  I'm stuck on Section 2 Step 1, I have no idea what to do here, my data view looks like this

Published: 12/01/2007

thats the only thing on each item, there is no spot to right click on a title and delete row.

I tried skipping step 1 but in step 4 everything disappears out of the post section on designer.  I'm working on this in the default.aspx of the blog site, I don't know if this is where I should be or not, I just added a posts webpart on the left hand blog navigator.  Any help is much appreciated.
Keith Bunge at 4/22/2008 11:50 PM

Re: Again

No problem.  Well lets see if your data view is just saying Published: 12/01/2007 and there is no title heading above all the Published you should be fine.  It could be that you removed the title heading in the list view.  In any case I think you should be ok.  The real issue seems to be step 4, but before we get there how do step 2 and step 3 go?  When you finish with those does every row look like this: 12/01/2007 (1) or some other number in the parens?  If it does that is good.  If not what is it looking like?

For step 4 review Figure 2.3, does your code view look something like that?  You should be able to jump to that view by clicking on the date in the publish column.  One key thing to remember is that you want to do most of this work in the code view and just use the design surface to jump around to the right position in the code view.  Let me know how things look in the code view before and after you make your changes in step 4.  Just paste in the whole <xsl:otherwise> tag.
Keith Bunge at 4/22/2008 11:50 PM

Still Working

I been playing with this all day and having a heck of time, and I found out something interesting, I guess Sharepoint Designer is "Font sensitive" because I typed in the code in word (looking at your image to make it easy) and when I pasted in it would throw an error over and over and over.  I copy paste from you site and it worked fine.....the difference? The font of the quote marks was different.....Thats it....
Keith Bunge at 4/22/2008 11:50 PM

Sorry

Sorry about the double posts, everytime I refresh the page it posts my comment again. Anyway what page did you open your posts webpart in. I created a webpart from the website in the Blog Navigator then opened up designer and started editing it.  I've noticed any changes I make to the code will make everything under the webpart we are working on go blank in designer, still shows up on the page and the changes I am making are working, but I didn't think they were, and I can't see my progress in designer. Is there a better place to work on this where it won't do this?
Keith Bunge at 4/22/2008 11:50 PM

Thank You!

Thank you for all the help, I got it working 100% and everything is perfect.  I have to say this has been probably the most helpful and well made blog posts on how to do something in sharepoint that I have seem, all the screenshots were great and everything melded well.  All the problems I was having above were because of my own ignorance :)

Thanks again

Matt
Keith Bunge at 4/22/2008 11:50 PM

Re; Thank You!

No problem at all Matt.  As for which pages Section 4 shows all the pages you will want to deal with to get it to show up everywhere in your blog.
Keith Bunge at 4/22/2008 11:50 PM

Me Again!

Hey Keith, I was wondering have you been able to post to a share point blog via Word 07. We are actually using the blog site as a news site.  I can't seem to get it to work and I can't find ANYTHING about why it isn't working for me.  You seem to be the only person I can find actually using Sharepoint for the blog :)

I made a technet post here for more info: http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?dg=microsoft.public.sharepoint.general&tid=ca2430ea-30be-4fcf-9508-c4ad9ee7ddba&cat=en-us-technet-sharepoint&lang=en&cr=US&sloc=en-us&m=1&p=1
 

Any help would be greatly appreciated :)
Keith Bunge at 4/22/2008 11:50 PM

Re: Me Again!

I have posted to a SharePoint blog using Word '07.  I think the key problem you may be having is how you have registered your blog in Word.  You should have gone to File -> Publish -> Blog at some point.  It asked you to register your account.  You can access this by clicking on Manage accounts in the Blog Post tab of Word.  Select the blog you have and click the Change button.  The Blog URL you want is basically the URL to your blog home page minus the default.aspx.  So if the URL to your blog is http://company.server.com/news/default.aspx you would type in http://company.server.com/news.

That should set you up assuming you are using BASIC or Windows Auth authentication.
Keith Bunge at 4/22/2008 11:50 PM

Re: Re: Me Again!

http://moss1:44134/sites/news/ is my blog site

I click manage accounts, choose Sharepoint Blog, put that URL in and It says the provider is unavailable, we are using NTLM Authentication on Sharepoint which is windows authentication.  I have only seen one other post of someone having this problem, and I haven't found a single blog that had something on this :|
Keith Bunge at 4/22/2008 11:50 PM

Re: Me Again!

Well that is a problem.  In general when I face thing like this I tend to start looking in to things that might help me explain what is going on.  I would take a look at the server and client Event Viewers and see if you see any errors.  I would also try using something like Ethereal or NetMon to actually see what your client is sending and receiving (though they will only capture HTTP traffic not HTTPS).  The return result from the server may be more informative than provider is unavailable.  I would also check the IIS and ULS logs to see if anything looks interesting in there.  I know it isn't a direct solution, but hopefully you will find that on the path of discovery.
Keith Bunge at 4/22/2008 11:50 PM

Can we remove the "Create Post" options for the contrubutors?

Can we remove the "Create Post" options for the contrubutors?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

Add Comment webpart missing in Template

Hi,

I have customized my blog template. After creating a blog from that template, I don't see the Add Comment form anymore.

Any ideas?
Keith Bunge at 4/22/2008 11:50 PM

While we're discussing things that are missing in Sharepoint blogs

How about threaded comments?

I was ready to live without them but I noticed how nicely they work in discussions. So now I have a dilemma. Do I try to configure a discussion to look like a blog with threaded comments or add threaded comments to the blog?
Keith Bunge at 4/22/2008 11:50 PM