Thursday, 17 February 2011

Hide "Home" link in top navigation of SharePoint 2010

Hide the home node in the top navigation menu of SharePoint 2010

 
In SharePoint 2007, if we set the datasource providor value of ShowStartingNode="False", the "home" link used to be hidden but if you try the same setting in SharePoint 2010, it does not work.


ShowStartingNode="False"
SiteMapProvider="Tried CombinedNavSiteMapProvider and SPNavigationProvider"

To fix this, I had to use the PortalSiteMapDataSource which used to exist in Moss 2007. To get it working follow the steps below:

1. Add a register tag to your master page


2. Add a PortalSiteMapDataSource to the master page

(Open Square Bracket) PublishingNavigation:PortalSiteMapDataSource


ID="GlobalNavDataSource"

Runat="server"

SiteMapProvider="CombinedNavSiteMapProvider"

EnableViewState="true"

StartFromCurrentNode="true"

StartingNodeOffset="0"

ShowStartingNode="false"

TreatStartingNodeAsCurrent="true"

TrimNonCurrentTypes="Heading" / (close square bracket)

 
 
3. Update your top navigation to use this data source instead

(Open Square Bracket)
PublishingNavigation:PortalSiteMapDataSource


ID="GlobalNavDataSource"

Runat="server"

SiteMapProvider="CombinedNavSiteMapProvider"

EnableViewState="true"

StartFromCurrentNode="true"

StartingNodeOffset="0"

ShowStartingNode="false"

TreatStartingNodeAsCurrent="true"

TrimNonCurrentTypes="Heading"/(close square bracket)



I have not tested it completly for side effects as I am just trying these things out in 2010. Will update this post if I find any side effects because of this.

Another way of doing this is through CSS...

 .s4-tn li.static > a {


display: none !important;

}

.s4-tn li.static > ul a {

display: block !important;

}












1 comment:

SharePoint Consulting said...

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. SharePoint Consulting is very important in the business world.