Friday, August 01, 2014

SharePoint 2013 Managed Navigation Lessons Learned

Posted in [SharePoint], [Technical] By Kyle Wright @ 9/22/2013



This post is going to cover how to configure the global navigation bar in SharePoint 2013 using Managed Navigation, as well as provide some tips and lessons learned with rendering the global navigation using new Managed Navigation in a custom master page. If you want the full details of Managed Navigation, check
this article on Technet.

Setting up Managed Navigation

First, I’ll start with the Managed Navigation settings. I have found this extremely useful and I much prefer to manage the navigation use the term store than the traditional navigation tools. It is “possible“ to create a cross-site collection (or even web application) navigation using the Metadata Navigation tools, but you do have to do some additional work for that.

To get started, just head to the site settings page for your site collection and click Term Store Management under the Site Administration section. In the term store, click on the right edge of the Navigation group and select New Term Set:

clip_image001

Name your term set, then click the Intended Use tab, check the box for “Use this Term Set for Site Navigation” and press Save.

image

Click the right side of your term set and select Create Term.

 image

Create all the terms for your navigation structure, then click the Navigation tab for a term. For this example, I am going to manually specify the destination URL, but you could easily use the Term-Driven navigation with friendly URLs if that meets your needs.

image

I have now built out my navigation structure:

image

Now that I have my navigation structure built, I can return to the site settings and set this as the navigation for my site. To do that, I’ll head to Site Settings, then click Navigation under the Look and Feel section. From the Global Navigation section, select Managed Navigation. A new section will appear on the page where I can select my term set that we created above. I’ll expand the Navigation group, then select my “Navigation Set 3” term set. Then, just head to the bottom and click OK.

image

So, now when we return to our site, we see all of our terms rendered as navigation items.

image

Using Managed Navigation in a Custom Master Page

Creating custom master pages is so much easier in SharePoint 2013 than it has been in previous versions, but it still isn’t quite perfect. For example, if you grab the Top Navigation snippet from the Design Manager for your master page, your Managed Navigation will not render correctly. This is an example master page with the Managed Navigation turned on, and the default top navigation snippet:

image

Pretty terrible right? It doesn’t render the drop down items at all. They are all rendered inline. You could obviously do your best to to apply JavaScript and/or CSS to get the drop-downs to function again, but why go through all that trouble when SharePoint should do that for you automatically. 

So, the easiest way around all this trouble is to grab the code that renders the top navigation from the HTML Seattle master page and paste that into your HTML master page. Here  is the code that is rendering the navigation in the Seattle master page for your copy/paste convenience.

   1:  <!--SPM:<SharePoint:AjaxDelta id="DeltaTopNavigation" BlockElement="true" CssClass="ms-displayInline" runat="server">-->
   2:      <!--SPM:<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">-->
   3:                       <!--SPM:<Template_Controls>-->
   4:                                       <!--SPM:<asp:SiteMapDataSource 
   5:                  ShowStartingNode="False"
   6:                  SiteMapProvider="SPNavigationProvider" 
   7:                  id="topSiteMap" 
   8:                  runat="server"
   9:                  StartingNodeUrl="sid:1002"/>-->
  10:          <!--SPM:</Template_Controls>-->
  11:      <!--SPM:</SharePoint:DelegateControl>-->
  12:      <a name="startNavigation"></a>
  13:      <!--SPM:<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">-->
  14:          <!--SPM:<SharePoint:AspMenu 
  15:              ID="TopNavigationMenu" 
  16:              Runat="server" 
  17:              EnableViewState="false"
  18:              DataSourceID="topSiteMap"
  19:              AccessKey="&#60;%$Resources:wss,navigation_accesskey%&#62;"
  20:              UseSimpleRendering="true"
  21:              UseSeparateCss="false"
  22:              Orientation="Horizontal"
  23:              StaticDisplayLevels="2"
  24:              AdjustForShowStartingNode="true"
  25:              MaximumDynamicDisplayLevels="2"
  26:              SkipLinkText=""/>-->
  27:                <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><link rel="stylesheet" type="text/css" href="/_layouts/15/1033/styles/menu-21.css" /><div id="zz7_TopNavigationMenu" class=" noindex ms-core-listMenu-horizontalBox"><ul id="zz9_RootAspMenu" class="root ms-core-listMenu-root static"><li class="static"><a class="static menu-item ms-core-listMenu-item ms-displayInline ms-navedit-linkNode" tabindex="0" title="Default Publishing Site" href="#" accesskey="1"><span class="additional-background ms-navedit-flyoutArrow"><span class="menu-item-text">Default Publishing Site</span></span></a></li></ul></div><!--PE: End of READ-ONLY PREVIEW-->
  28:      <!--SPM:</asp:ContentPlaceHolder>-->
  29:  <!--SPM:</SharePoint:AjaxDelta>—>

 

Once we add that to our HTML master page, the navigation magically looks like this:

image

Just by grabbing a different snippet we saved ourselves all the trouble of building our own drop-down and fly-out navigation. If you need more fly-out levels, you can just update line 25 from the code above. 

Stay tuned for a future post to turn the navigation item above into this with some custom CSS branding:

image

If you have any questions regarding this post or C5 Insight's services and solutions, please contact us.


, , , ,

Comments

Got something to say? Join the discussion »
    Posted by Raghavendra on 2/7/2014
    Hi,
    I am also facing same issue, but above method not worked for me. Still Navigation is not loading in drop down. But it is working fine with Seattle master not with my custom master.
    Posted by C5 Insight Blogs - Microsoft SharePoint, Dynamics on 11/20/2013
    Trackback from C5 Insight Blogs - Microsoft SharePoint, Dynamics CRM and Salesforce.com

    In a previous post I described how to use the Managed Navigation functionality that is new in SharePoint 2013 to create a global navigation based on a Managed Metadata term set. This post is going to provide you with all the CSS you need to fully brand... ...
    Posted by Kyle Wright on 9/24/2013
    Jeremy, thanks for your comments. No, you cannot use the same term set for more than one site collection. However, if you were just going to use a moderately sized term set and only use it on a few site collections, I don't think it would be too much work to use the "Reuse Term" function and copy your terms to another term set. This would at least allow you to update links once if they needed to change and have that flow across your site collections. Not sure if you mean 10,000 terms or site collections, but either way, this isn't for you. You would need a custom navigation at that point.
    Posted by Jeremy thake on 9/23/2013
    Nice post, does it work cross site collection? Say if I had ten thousand of them? Heard it couldn't and never had time to check.

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011-2013 by C5 Insight