Tuesday, April 24, 2012

Hiding the First Top-Link Tab for a Publishing SharePoint Site

After enabling the SharePoint Server Publishing Infrastructure feature on a SharePoint site the first tab in the top-link bar automatically changes to the site title:

Here is an example of a site before the publishing infrastructure has been enabled:

This is what the site looks like after enabling the feature (I also changed the site title to further illustrate the problem):

This can be a very undesirable result when the site title is long or just undesirable as the first tab's label.  With a few masterpage changes this behavior can be remedied.  To accomplish this follow these steps:

Open the site in SharePoint Designer and go to the Master Pages left navigation. 
Make a copy of the "v4.master" and rename it to something like "modified.master":

The first step is to edit your new "modified.master" and add the following line to the Registers at the top of the master page:

<%@ Register 
 Assembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 

Further down in the master page you will find a block of code that looks something like this:

The part of the code that we are going to focus on is the SharePoint:DelegateControl.  A good article that describes the purpose of the DelegateControl can be found here: http://msdn.microsoft.com/en-us/library/ms432695.aspx.  We are going to replace this delegate control with a control that we can customize a little bit more.  Highlight the SharePoint:DelegateControl (like shown below) and delete it:

We are going to replace the deleted text with the following:


This creates a new TopNav datasource.  This data source will still consume the out of the box data navigation, but will not show the first tab (created by the publishing feature).

After making this modification the top link bar the top link now looks like this:

For more information on this topic check out these other blogs:


No comments:

Post a Comment