Global navigation does not show folders in subsites
-
29-09-2020 - |
Question
In a SharePoint 2013 publishing site, I set up global navigation to show structural navigation.
Basically, I have this following site hierarchy:
- root
- subsite
- sub-subsite
- sub-subsite2
- subsite2
- subsite
This is the physical structure, but I want to set up this logical user navigation:
- root
- subsite
- sub-subsite
- Folder
- sub-subsite2
- Folder
- subsite2
- subsite
To achieve this result, I tweak the navigation of both subsite and root to create a navigation folder.
However, this is not working as expected. The folder in the root site is shown in the navigation, but the folder within the subsite does not appears.
How can I set up my navigation to reach my goal ?
Actually, the application I'm working on uses a custom master page. If I have to update it, it can be done.
By now, the navigation menu is defined using:
<PortalSiteMapDataSource
ID="topSiteMap"
runat="server"
EnableViewState="false"
SiteMapProvider="GlobalNavigationSwitchableProvider"
StartFromCurrentNode="true"
StartingNodeOffset="0"
ShowStartingNode="false"
TrimNonCurrentTypes="Heading" />
<AspMenu
ID="TopNavigationMenu"
runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCSS="false"
Orientation="Horizontal"
StaticDisplayLevels="1"
AdjustForShowStartingNode="false"
MaximumDynamicDisplayLevels="2"
SkipLinkText=""></AspMenu>
FYI, here is the actual result:
And here is the navigation settings of the root site:
Finally, the navigation settings of the subsite:
Solution
Actually, the solution was quite simple. I had to remove the attribute TrimNonCurrentTypes
from my datasource:
<PortalSiteMapDataSource
ID="topSiteMap"
runat="server"
EnableViewState="false"
SiteMapProvider="GlobalNavigationSwitchableProvider"
StartFromCurrentNode="true"
StartingNodeOffset="0"
ShowStartingNode="false"
/>
And it solved the issue.
Don't know why this attribute is set by default on OOB master pages.