Posted on:
Categories: SharePoint
Description:

​When creating custom master pages for SharePoint 2013 it's nice to be able to use it with many site templates (e.g. Publishing sites, Search and possibly Team sites. As compared to previous versions of SharePoint you usually needed a unique master page for each usage scenario.

While working with a custom master page, I ran into a weird issue when testing it with some Team sites. When using structural navigation for the left navigation (Quick Launch) I noticed with the custom master page the left navigation was blank. I switched the master page back to Seattle.master and all my expected navigation items showed back up. This was even more confusing because our custom master page was fairly similar to the default Seattle.master file.

After further testing I was able to at least determine the master page element that was at fault as we as two workarounds for the issue:

  1. Enable the SharePoint Server Publishing Infrastructure Feature (Site Collection Scoped)
  2. Change the SiteMapProvider for the Left Navigation

So, if you look at the code snippet below from the master page you'll see highlighted the default SiteMapProvider that is being used.

<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>

For some reason when using a custom master page on Team sites, the SPNavigationProvider doesn't return any links configured in the Quick Launch settings (even Lists and Libraries set to show on Quick Launch or even links/headings you manually added). It appears that the SPNavigationProvider provider is dependent on the SharePoint Publishing and when you use the out of the box master pages with a team site there is either a delegate control injected that overrides the SiteMapProvider that is embedded in the master page (SPNavigationProvider) or there's another site/web property that I'm not aware of that enables the Quick Launch to work properly.

So for solution 1, if you are ok with all the extra libraries and lists created, than you can just enable the SharePoint Server Publishing Infrastructure Feature (Site Collection Scoped) . The left navigation will then appear exactly as it does in the Navigation settings as it's now using Current Navigation instead of Quick Launch.

Solution 2 doesn't require any site structure changes, but it does require a minor change to your custom master page. If you change the SiteMapProvider from SPNavigationProvider to CurrentNavigation the Quick Launch navigation will properly appear.

<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="CurrentNavigation"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>

This change will also work for Publishing sites as well, so if you are doing a single custom master page for both Publishing and Team sites this solution would work.