Skip to main content

Creating a Two Tier Global Navigation

Two tier navigation is not a new concept and has been out for quite a long time. However SharePoint OOTB does not allow you to have a global navigation that spans multiple site collections.

Here are a few examples of a multi tier horizontal navigation.

Example 1: MSDN: Microsoft Developer Network

Example 2: Fed Ex

Example 3: Wall Street Journal

During a recent project I was given the task to create a global navigation that had two tiers like the examples above.

After some investigation my friend Sahil Malik had put together a great blog about creating a consistent navigation across site collections. (Thanks Buddy)

Well this is great and all but his code replaced the OOTB navigation with a custom one. So after some hard thinking I figured out that you could create your own control that drove the tier 1 global navigation (Across site collections) and a tier 2 local navigation (OOTB) that was security trimmed.

To get this to work you should use Shail's post as a guide for code but here are the basic steps:

  • Go to: \inetpub\wwwroot\wss\VirtualDirectories\yourwebappname
  • Create a back up of the web.config on each of the web applications that you want the two tier navigation
  • Add the following to the custom web.config file

<add name="CustomXmlContentMapProvider" siteMapFile="_app_bin/mainMenu.sitemap" type="Microsoft.SharePoint.Navigation.SPXmlContentMapProvider, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

  • Go to: \inetpub\wwwroot\wss\VirtualDirectories\yourwebappname\_app_bin
  • Create a file called "mainMenu.sitemap" and add in your navigation simular to something like below

<?xml version="1.0" encoding="utf-8" ?>
    <siteMapNode title="Tab 1 Home" url="/Pages/Default.aspx">
        <siteMapNode title="My Site" url="">
            <siteMapNode title="My Profile" url=""/>
        <siteMapNode title="Collaboration" url="/Collaboration/Pages/Default.aspx"/>
        <siteMapNode title="News" url="/news/Pages/Default.aspx">
            <siteMapNode title="News 1" url="/news/news1/Pages/default.aspx"/>
            <siteMapNode title="News 2" url="/news/news2/Pages/default.aspx"/>
            <siteMapNode title="News 3" url="/news/news3/Pages/default.aspx"/>

Finding out the hard way you cannot have any of the siteMap Node elements have the same url or title...

Please note that if you are placing this custom control on the mysite the relative links will have to be changed to absolute due to the fact that they reside in different web applications.

  • Next you will have to add in the custom control to your masterpage. This can be a bit tricky.
  • Copy the OOTB navigation control "<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">"
  • Place this control in a <TR> tag right above the OOTB navigation control
  • Like in Sahil's blog post rename the DataSourceID= from in the custom control from "topSiteMap" to "xmlSiteMap"
  • You will also need to modify the content placeholder and menu ID's see highlighted items below:


Once you get it finally working your new navigation will have the following functions:

  • Tier 1: Global Navigation
    • Always Consistent
    • Not Security Trimmed
    • Manually configured on the server Via XML (I'm sure if you wanted to get tricky you could hook this up to custom list or something...)
    • Globally across site collections, web applications and even external applications if you wanted (Basically anything)
  • Tier 2: OOTB Local Navigation
    • Changes based on site collection
    • Security Trimmed
    • Configured through the UI
    • Only shows navigation within the site collection

So here is a screenshot of the custom two tier global navigation control:


Have fun customizing, and drop me a line if you have created something similar!


Hector Insua said…
Thanks Erik Great Post!!
Omar Molinares said…
Thanks Erick for your excellent article!
fromonesource said…
Is there any way to get sitemap nodes beneath the first sitemap node? In your examples, you have a second tier beneath the first item in tier one. I have run into issues doing that because the sitemap providers only allow for one root sitemap node. Would you be able to share your sitemap xml and perhaps some more code from your master page? Thanks for the great article.
BSpurlock said…
When I try to run this I get a runtime error. I went back and check everything but I cannot get it to work. I'm a graphic Designer learning SharePoint so if anyone can point me in the right direction to find what is wrong I would greatly appeciate it.
web designer said…
Very nice article.
Sendil said…
Hi, I couldn't achieve wat u did in( 2 tier) ur blog pls help me to sort out
Laleh said…
I tried your solution, but I have a unexpected error when I run my page,Probably some thing was missed in my master page ,would you pleas put your master page here
Erik Swenson said…
I see that some people are getting error's. It is really important that you have the ID's matching, and that you reference the correct datasource for your sitemap provider. Also if your XML is not correct in the site map provider it will throw an error.
Laleh said…
1.I changed the Ids and it works fine,but I need some clarification,I want to have relation between these 2 horizental navigation tabs,I mean when I click on the one of upper tab the childs should be displayed in lower horizental navigation tab(no drop dwon list)

2.another thing is it possible to use sitMap as datasourse for both horizental navigation tabs(I supposed to have dynamic data source) and having parent/child relationship between them.

If is it possible can you upload your whole solution included css file.
Anonymous said…
I posted mine! I'm so excited about this. Thanks for hosting it! Add
Anonymous said…
Your blog is very nice... i like your blog. Free Web Directory
John Fox said…
Any way we can get more of the masterpage as an example. i can get the single tier but not the double tier working. keeps throwing an unexpected error But overall very helpful. just need that second tier to get it implemented on my site
Erik Swenson said…
John Fox, I have created a new post with the source files:
John Fox said…
Thanks a lot man. i got it working great but some of our remote sites with slower connections are still having issues. I'm working through them and appreciate the help
John Fox said…
is there a way to make the second menu i have, reading from the "topsitemap" allow drop downs. when i make it a sub on the native sp navigation it just puts it right beside it unstead of creating a drop down
Erik Swenson said…
I have created a new post on how to use this method to create a Two Tier Global navigation for SharePoint 2010.

John Fox,
Try changing StaticDisplayLevels to "1" and MaximumDynamicDisplayLevels to more than "2"
Elena said…
Thanks Erik, Great Post!!

I tried your solution in sharepoint 2010. I have 2 tier drop down menu, but I can`t get the example you did in 2007 (for example Wall Street Journal ) with 2 tiers in horizontal without drop down.

Could you help me with this issue please??


Anonymous said…
Work your tool in SharePoint Foundation? I want to get an tier global navigation.
Anonymous said…
Thanks so much for your branding blogs for 2010, very simple to follow and helpful as I transition from 2007.

If anyone does have articles specific to meeting accessibility guidelines (tweaks required) I would appreciate any links.
Anonymous said…
Thanks Erik....While trying this I am getting error as 'Sitemap is not found'..

One more : Will I get the horizontal display at the second level navigation with this approach???
Rich Mills said…
Nice post. Simple and to the point. This is exactly what I'm trying to do, and I think I've more-or-less set it up to work this way. However, I'm not seeing any security trimming.

You mentioned that Tier1 is NOT security trimmed, but Tier2 IS security trimmed. Are you actually getting the behavior to work? How do you control whether the menu items appear?
Erik Swenson said…
Rich Mills,
You are correct the top tier is not security trimmed. The second tier should be security trimmed by default since you will be using the OOTB top navigation control which comes standard with the ability to security trim its content. Make sure your second tier (The one on the bottom) is using the OOTB top navigation control.
Anonymous said…

I can't see multi-levels in application pages, how can I see them?


Anonymous said…
Excellent post.I want to thank you for this informative read, I really
appreciate sharing this great post. Keep up your work.
Web design quote
aparna john said…
Hi,In our experience, for the initial Web Design Cochin, too often customers spend too long thinking about the initial visual design and not enough time on the navigation structure.Thanks.....

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

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…