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

sukiakisu 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!
venkata 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!
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: Hide Left Side Navigation on Home Page

I was recently asked: "How can I hide the side nav bar on the main homepage layout ?? I want to be able to use the side NAV with in the team site etc etc, but I don't want it on the front page.. " There are a couple of ways to do this in SharePoint 2010. If you are using a non-publishing site you can add a Content Editor Web Part to the page and add the following to the HTML Source.
<Style>
body #s4-leftpanel
{
display: none;
}
.s4-ca
{
margin-left: 0px;
}
</style>
Basically the CSS above hides the left navigation Div, and then sets the content area to not have a left margin. Once you are done, simply modify the web part and hide it on the page. If you are using a publishing site for your homepage simply add the same styles specified above to a custom page layout. That way if you have a need for other pages that do not need the left side navigation you can re-use the page layout.

Small Calendar for SharePoint 2010 & 2013

First off I would like to apologize for the lack of posts. I have been really busy with my new role as the UX Design lead within Slalom Consulting Boston. I will share more about that in another post. In a previous post Create Really Small Calendar I showcased how to do this for SharePoint 2007. However the 2010 and 2013 calendar views have changed and therefore we cannot use the same method or CSS as 2007.SharePoint 2010 Small Calendar:
SharePoint 2013 Small Calendar:
See video below for a video walk through on how to create a small calendar for SharePoint 2010 and & SharePoint 2013 with just CSS.Per the video above here is the code that I referenced:2010 CSS link reference in Master Page:
<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/smallcalendar.css %>" After="corev4.css" runat="server"/>2010 CSS:
/**** Small Calendar ***/
.ms-acal-item{height: 10px !important;}
.ms-acal-sdiv,
.ms-acal-mdiv,
.ms-…

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 RowTable Row Left Site Actions Navigate Up Edit Tab List Browse Page Table Row Right Give Feedback Welcome Menu WorkspaceBody Container Title Row Title Title Logo Title Text / BreadcrumbPage DescriptionSocial Data SeparatorI like It Tags/Notes Top Header 2/Top Links li Static-Selected li Static SearchHelpStatus Bar Container Main A…