2

I am building the navigation for a hub site in SharePoint Online using PowerShell and I want some of my links to be headers only (not URL).

I am using the following Powershell commands to create my navigation nodes:

To create a menu item with a hyperlink I use: Add-PnPNavigationNode -Title "Menu 1" -Url "" -Location TopNavigationBar

I am trying to create one without a link (so just a header) and I tried:

Add-PnPNavigationNode -Title "Menu 2" -Url "" -Location TopNavigationBar -Parent 123 # empty Url paramter

Add-PnPNavigationNode -Title "Menu 2" -Location TopNavigationBar -Parent 123 # no Url parameter

Both options are creating a menu item with a link to the hub home page.

Note that if I edit the links through the UI I can change it from URL to Header.

Any idea how I can create a Header item in the top navigation?

Thanks

2
  • I've did multiple tries and the cmdlt seems buggy as hell. Seems to be some problems reported on github related to it. github.com/SharePoint/PnP-PowerShell/… Sep 27, 2019 at 14:58
  • Yeah, tried all the option available. it seems previously they have option to add header but currently every Navigation node need to be added as link. may be you need to raise as userVoice or github forum Sep 27, 2019 at 15:28

1 Answer 1

1

Don't know if you're still facing this problem with but I had the exact same issue and found a solution. Set the header node's URL to "http://linkless.header/"

Try using the commandlet as such

Add-PnPNavigationNode -Title "Header" -Location "TopNavigationBar" -Url "http://linkless.header/"

2
  • Yes, this is exactly what I ended up doing. Jun 25, 2020 at 6:47
  • This is the solution in the documentation of the commandlet . But for me it still creates a clickable link, not a label. DId it create a label for you Malte? May 27, 2022 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.