My original article used CSS to hide the first navigation tab, but if you want to make the change via the master page navigation control there are some simple changes that you will need to make. I originally thought by just changing the “ShowStartingNode” property it would simply hide the first node but by default it has it already set to false: ShowStartingNode="False" so the approach below is what worked for me.
Here is the base top navigation control:
<SharePoint:AspMenu
ID="TopNavigationMenuV4"
Runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="1"
SkipLinkText=""
CssClass="s4-tn"/>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
First off Remove the following: <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate"> <asp:SiteMapDataSource
<Template_Controls>
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server" StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
And then make the following changes to the static, dynamic and site map provider:
<SharePoint:AspMenu
ID="TopNavigationMenuV4"
Runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="1"
MaximumDynamicDisplayLevels="2"
SkipLinkText=""
CssClass="s4-tn"/>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="CombinedNavSiteMapProvider"
id="topSiteMap"
runat="server"/>
The result would look something like this:
Thanks to c_marius for the comment and jsalazar80016 for the approach.
Comments
I have a quick question, but this is not relevant to this post. How would i automatically inherit a custom masterpage and css to a new subsite created in SharePoint 2010?
Do you have any guidelines for creating a stapling feature which forces the custom masterpage to be used in all new subsites created.
I am aware of the changesitemasterpage.aspx in the root site to force the settings but i am looking for an automatic process. I appreciate any help on this one.
BTW , i am a regular follower of your posts ..
Love your work.
Venkat
Thanks a lot.
Great Post, Very Usefull.
I have a question. I created a dropdown menu by following this post, but only 20 submenu appear in the menu on my site and in my site there are 22 subsites.
Any ideas?
Please help me.
div.menu-horizontal > ul.static > li.static > a { display:none !important;}
Thanks a lot!
There is a mistake in your post: StartingNodeUrl="sid:1002"/> should not be removed, right?
I am also working with a problem that all items (libraries etc.) comes under top level navigation after this change. What should I do if I want only sites and pages to appear on top level navigation?
Any help will be appreciated.
Did anyone find a solution to hide all items (libraries etc.) comes under top level navigation after this change. I need to display only sites and pages to appear on top level navigation