Skip to main content

Update: Hide First Tab in SP 2010 Navigation

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>

image

First off Remove the following:
<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>

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:
image

Thanks to c_marius for the comment and jsalazar80016 for the approach.

Comments

Anonymous said…
great post! this would definitely be my first choice for doing this in 2010 so that you can retain the simple rendering. thanks for the tip!
Venkat Koppolu said…
Hi Eric,
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
is three level navigation is posible
Anonymous said…
Great Article!

Thanks a lot.
ljcmaster said…
Hi Eric,
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.
eduferreira said…
To hide by CSS:

div.menu-horizontal > ul.static > li.static > a { display:none !important;}
Lodlaiden said…
This method works, but any items that are hidden through the _layouts/AreaNavigationSettings.aspx page will be shown.
Anonymous said…
Very useful post!! I tried various solutions but in vain however this one is the master piece!!!
Thanks a lot!
Soren said…
Just what I needed - thanks
Anonymous said…
Hi!
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?
Maulee Vadi said…
I tried the master page change and it works but my Welcome Page URL is still pointing to default.aspx page and so when I just type URL for my site, it defaults to Default.aspx page which I don’t want.. and if I change the Welcome page URL, my first tab is hidden but now 2nd tab gets hidden too..

Any help will be appreciated.
viji said…
Hi,
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

Popular posts from this blog

How To: Create Hyperlink to Modal Pop-Up Form

I was asked by a client recently if there was a way to create a hyperlink to a New Item Form anywhere within a site but still get the rich experience of the Modal pop-up window that grays out the background. (Note this is for SharePoint 2010 Only…) I basically took the code directly from the “Add new item” and the “Add Document” link within the list view. What this allows you to do is simply add in the following code to any content editor web part, Master page, or Page Layout in any site collection and display the form to be filled out. The user will get the nice experience of the modal window and not have to navigate away from their current page. This could be used for example a feedback form that is included in the master page so whenever someone wants to give feedback it is always going back to a central list. The only that is required for you to know is the List ID and the site name. Full Code For a List Item: <a onclick="javascript:NewItem2(event, &quot

SharePoint 2010 Base CSS Classes

This will be the first of many SharePoint 2010 posts. I will be focusing on a few of the main CSS classes used for SharePoint 2010 Public Beta. As the product becomes more final there might be some changes to the class names but I will be sure to create a new post if that happens. This will be quite a lengthy but it should be helpful. The default CSS given below are just highlights of the full CSS attributes for that class. I will be using a basic team site as my base for the screenshots. Here is a basic structure of the main areas that I will cover. Ribbon Row Table Row Left Site Actions Navigate Up Edit Tab List Browse Page Table Row Right Give Feedback Welcome Menu Workspace Body Container Title Row Title

SharePoint 2013 Responsive Table Columns

I have been wanting to write this one for a while now. It is really amazing how UX is really finding is way into everything that we use and interact with. From Custom applications both mobile and on a desktop to document management or large data visualizations. There is always room for better usability and new concepts. SharePoint lists and library functionality really has not changed much for the past 10 years... I remember back in 2003 when I saw the same table/grid based views of documents and list items that exists in SharePoint 2013. But now we can look at them in a whole new way! In this video blog you will see how to create a responsive CSS table so that when the browser size is reduced it will hide specific columns. However hiding data is not always the right thing to do. What if a user needed those columns to filter on or to use for comparison to another document? Well that is where the custom jQuery Column chooser comes in. It allows you to see what columns are displ