Forum Discussion
Christian Enghaug
Dec 12, 2016Brass Contributor
Modern Team Site - Global navigation
Hi All, I currently work with a customer that have a site collection with sub sites, where they use a global structural navigation of the sub sites in two levels (with dropdown). I want them to ta...
kiran bellala
Mar 08, 2017Brass Contributor
Christian Enghaug
I am doing the same thing which is to enable publishing features and setup navigation. However, the global navigation is not inheriting to sub sites. Did you have the same issue? Did you setup global in each sub site manually?
I am doing the same thing which is to enable publishing features and setup navigation. However, the global navigation is not inheriting to sub sites. Did you have the same issue? Did you setup global in each sub site manually?
Christian Enghaug
Mar 09, 2017Brass Contributor
Yes, sub sites were configured to inherit the global navigation, but instead of displaying the parent global navigation, the local navigation was displayed as the global navigation on sub sites. In my developer tenant inherit of the global navigation seems to be fixed now.
I configured the global navigation manually on each sub site, but you could use PnP PowerShell and the Provisioning engine to do this. Something like this:
$cred = Get-Credential Connect-PnPOnline -Url "<URL to site where you have configured the global navigation>" -Credentials $cred Get-PnPProvisioningTemplate -Out "c:\NavigationTemplate.xml" -Handlers Navigation
Then remove the CurrentNavigation from the template (c:\NavigationTemplate.xml). And then apply that template to all sub sites.
Connect-PnPOnline -Url "<URL to site where you have configured the global navigation>" -Credentials $cred
$subWebs = Get-PnPSubWebs -Recurse
foreach($web in $subWebs){
$web.Navigation.UseShared = $false
$web.Update()
$web.Context.ExecuteQuery()
Apply-PnPProvisioningTemplate -Path "c:\NavigationTemplate.xml" -Handlers Navigation -Web $web -ClearNavigation
}
This is not tested, and is just an example of how you could do this by PowerShell.