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

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 2010 Content Query for Blog Posts

I hope this post will help many of you feel comfortable with using the Content Query Web Part. In this post I will walk you through the process of creating a content query web part and configuring it to show custom field types. I will also give details on how to use XSLT to stylize and format the data being pulled. I will be using the following scenario as an example. Say that you had a site collection with a top level publishing site. This publishing site would display a the most recent blog posts from all blog sites within its own site collection. To solve this problem we will use a Content Query Web Part and a customized ItemStyle.xsl using XSLT. Please note that the “SharePoint Server Publishing Infrastructure” needs to be enabled at the site collection to display the content query web part. Step 1: Add a Content Query Web Part to Page Navigate to the site that you want the blog posts to show up and click on edit page. Under Editing Tools in the Ribbon, Click on ...

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...