Hi, JinweiLi. I was traveling, but will be able to try your solution this week. Thanks for the follow-up.
SharePoint Hub Navigation Not Working
In SharePoint 365, I have a hub site and numerous child sites with that hub site specified as the parent.
However, when setting up hub navigation, when I add "Associate Child Hubs" none of the child hubs appear in the list. The only link that comes up is the hub site itself.
I have tried removing all hubs and recreating/reassociating them. Tried Mega Menus and Traditional. Nothing seems to make them work.
Any suggestions?
Thanks,
- Brad
6 answers
Sort by: Most helpful
-
-
B D 31 Reputation points
2022-11-07T19:32:27.993+00:00 @Jinwei Li-MSFT , unfortunately, while the script did work to associate child hubs, nothing appears in navigation under Associated Hubs or Associated Child Hubs.
-
S D Andrews 151 Reputation points
2022-10-26T19:27:33.137+00:00 Hi BD,
Welcome to the Q&A Forums.
One thing to clarify please. Are you allowing any time for the changes to apply to the associated children sites? On occasion I've had to wait a little bit before changes became visible.
Thanks
Steve -
B D 31 Reputation points
2022-10-26T19:30:41.047+00:00 Thanks for responding. This has been a problem spanning several weeks, so yes.
Not sure if it is relevant, but I also turned off navigation caching in an attempt to see if that made a difference, but no luck.
-
Jinwei Li-MSFT 4,726 Reputation points Microsoft Vendor
2022-11-04T06:15:26.177+00:00 Hi @B D ,
I suggest you could try to use PnP-PowerShell to add "Associate Child Hubs".
#Config Variables $TenantSiteUrl = "https://crescent-admin.sharepoint.com" $HubSiteURL = "https://crescent.sharepoint.com/sites/Intranet" $SiteURL = "https://crescent.sharepoint.com/sites/2020projects" #Connect to PnP Online Connect-PnPOnline -Url $TenantSiteUrl -Credentials (Get-Credential) #Associate Site collection with HubSite Add-PnPHubSiteAssociation -Site $SiteURL -HubSite $HubSiteURL
If you want to add multiple sites to a Hub site, please try to use this code:
#Config Variables $TenantSiteUrl = "https://crescent-admin.sharepoint.com" $HubSiteURL = "https://crescent.sharepoint.com/sites/Operations" $SitesToConnect = "https://crescent.sharepoint.com/sites/Ops","https://crescent.sharepoint.com/sites/OpsV2","https://crescent.sharepoint.com/sites/OpsV3" Try { #Connect to PnP Online Connect-PnPOnline -Url $TenantSiteUrl -Interactive #Get the Hub site $HubSite = Get-PnPHubSite -Identity $HubSiteURL #Get all sites connected to the Hub $SitesConnectedToHub = Get-PnPHubSiteChild -Identity $HubSiteURL #Associate each Site collection with HubSite ForEach ($Site in $SitesToConnect) { #Check if the site is alreay connected with the Hub If($SitesConnectedToHub -contains $Site) { Write-host "$Site is Already connected to Hub Site" -ForegroundColor Yellow } Else { Add-PnPHubSiteAssociation -Site $Site -HubSite $HubSiteURL Write-host "$Site Connected to HUB Site Successfully!" -ForegroundColor Green } } } catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.