Skip to main content

SharePoint 2010 Two Tier Global Navigation

I have been asked quite a few times if the SharePoint 2007 two tier global navigation will work with SharePoint 2010. The answer is yes with a few slight modifications. The approach stays the same: Master Page points to web.config > web.config points to .sitmap file > Page Renders custom navigation control.

The difference between 2007 and 2010 of course is that you want to add the custom site map provider to the new 2010 web.config file. Search for the following in the web.config file: “sitemap”. within the last row add the following:

<add name="DEMOGlobalNavSiteMapProvider" siteMapFile="/_layouts/1033/styles/demo/DemoGlobalNav.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

You will notice that I placed my custom sitemap file in the style folder within the layouts directory.

There is also some slight changes to how your reference the navigation control in the 2010 master page. Here is the reference:

<!-- Start Custom Global Navigation -->
                    <div class="s4-lp s4-toplinks">
                                <asp:ContentPlaceHolder id="DemoGlobalNav" runat="server">
    <SharePoint:DelegateControl runat="server" ControlId="CustomXmlContentMapProvide" Id="DemoGlobalNavDelegate">

<!-- End Custom Global Navigation -->

I have placed an example of this custom two tier navigation for SharePoint 2010 in the following .zip file: Download it Here

Here is how it will look:

Post a comment and let me know what you think. Enjoy!


bill said…
hello, and thank you for your postings.

question about this menu item, in the master do you simply add all the code there and leave the master as is or remove the original code? I see in your attached example you leave the old stuff and simply inserted the code? Still new to SharePoint and learning, but looking for this type of menu system.

thanks again.
Dan said…
G'Day Erik,
Got another one for you..

Using the Issues Web Database template to cteae a helpdesk type app.. How can I got about getting our header and global Nav onto this ? or for that matter all new templates that are created ? I'm assuming I have to update a master page somewhere...
Praveen said…
How To: Create Hyperlink to Modal Pop-Up Form

Good Info,Can u pls help me out for a Solution am also looking for making the "Add Document" to Place in the Top navigation Header Beside to Search Text Box according to my requiremnt.
Can u guide me how to make it possible and that once am clicking on the somee XX Doc Lib the same Upload functionality has to happen for "N" Number Doc Lib as per my client requirement.

I tried your Tip but it is only for a particular Lib !!!

Thanks in Advance !!!!

Anonymous said…
Thanks. Works fine on the root site of a site collection but as soon as you navigate down to subsites, the subsite URL automatically gets included as part of the links and so the links break. The sitemap used to work fine in 2007 but something in 2010 has changed the way it works.
Nick Kellett said…
Hi Anonymous, to fix the problem with the relative links, instead of using the SharePoint 2010 site map provider in the web.config, use the native XML one instead:
Nick Kellett said…
add name="MyNavProvider" siteMapFile="/_layouts/1033/MyNavProvider/mySiteMap.sitemap"
type="System.Web.XmlSiteMapProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /
willy said…
Awesome article.THANKS

2 questions:

when you change the type to System.Web.XmlSiteMapProvider, System.Web, Version=, Culture=neutral,
it seems to change the css of my nav, have you guys encountered this bug?

Is it possible to store the mySiteMap.sitemap into a library (i.e sitecolletion/Documents/Forms/AllItems.aspx ?

thank you,*
SPDeveloper said…
Great Post...Thanks Mate
Anonymous said…

Thanks for this tricks... But i try to do this and i ve got an error :

Do you know if we can put more than one two tier in a tier?
Many thanks
Anonymous said…
Here 's my code ....

Anonymous said…
Impossible to post my code ;-)

I just want to have 2 time "division1" in division...but i got an error
PNKV Prasad said…
This is really awesome.
But after i modified master page with this navigation, if i try to modify any site settings(like Site columns,Site content types,Web parts,List templates,Master pages,Themes,Solutions) from browser, its giving error. I tried this by making this master page as Custom master page. but still all site settings links are giving errors.

Joseph said…

Its a nice one.

Is it possible to make this as security trimmed menu

if so please mail me
Jay said…
How do i manage security with it?
A two tier navigation can be acomplished with Out of the box SharePoint.

/* Styling for two tier navgiation */
div.s4-tn {
height: 50px;

li.dynamic {
display: inline-block;
margin: 0 3px;
Ray G said…
Does anyone know if this can be implemented in a Publishing Portal?

Andrey said…
Hi Erik,
thank you for a great post, all works fine, but with one constraint: you can't have 2 exactly the same links in the menu, it crashes the whole site, I was able to avoid this issue and just created similar views with different names. but if there is something happened with my manu - it will crash the whole site. If you know how to avoid this critical issue, please adwise.
Orrin said…
I can't see my custom navigation on application pages. Could you help with it?


Andrey said…

please, ensure that you've put it to the right place on the masterpage (v4.master) - see example from post author.
Orrin said…
Hello Andrey,

Thanks for your reply. It is on the right place. I think I will go ahead and make changes on application pages. I have another question; my custom site map does not properly work on subsites. When I go to subsite, I exactly have the same top nav, but the links do not take you to the right place. For example; I click another site, it takes you to the place in current site. Could you tell me what can be the problem?

Thank You
Andrey said…
also on your app pages the ContentPlaceHolder wich contain CustomMenu is absent (in the example it "DemoGlobalNav").
About proper work of your custom menu on subsites - I can think only about one option: your links begin with "~/List/ListName" or "~/DocLibName", put full links, like "http://SiteName/..." instead.
Orrin said…

I tried to put full links. Somehow it does not work properly.

asif said…
i have tried this and i can only see one Home tab in global navigation and all link coming under that tab... any help
Orrin said…

I fixed the links by using "add name="MyNavProvider" siteMapFile="/_layouts/1033/MyNavProvider/mySiteMap.sitemap"
type="System.Web.XmlSiteMapProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /" in web.config.

I understand that multi-levels do not apply on safeguarded application pages, and it can be fixed by modifying them, but how about some other pages like; sitesubs.aspx. Css works but multi-levels do not work on same app pages. How can I use at least three levels custom navigation menu on application pages?

Vinay TS said…
Hi Orrin,

Can you please share me the master page code for this contentplaceholder??

Thanks in advance..
Anonymous said…
Hallo Eric,
thanks much for your post, it is good for me.

I have two questions:
1. How to hide original menu "Home"
2. How to hide the menu "View all Site Content", located directly below the original menu.
Both are visible in your post on picture at the end.
Thanks Karel
Gopinath said…
Hi Eric,

Thanks. It solves my problem.
Mandeep said…
Hello Eric,

When I try to implement this I get an error : Error parsing control: The SiteMapProvider 'demoGlobalNavSiteMapProvider' cannot be found.

I placed the DemoGlobalNav.sitemap file on "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\STYLES\DEMO"

Changed the web config on my App server as you mentioned

and the master page changes copied from your v4.master.

It throws up the error. Can you help please ?

Suresh Lakum said…
Hello Eric,
First of all great article really very helpful.
But I am facing some problem,i.e. whenever I navigate to site settings my navigation menu is not displayed.

Want to know reason behind it.Otherwise it works very fine.
Andrey said…
Suresh Lakum,
make sure that Default and Custom master pages both have DemoGlobalNav placegolder inside. Because Custom masterpage is used for displaying System pages, like Settings etc.

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

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.
body #s4-leftpanel
display: none;
margin-left: 0px;
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.

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 PageNavigate 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 insert > Web PartUn…