Create a navigation heading node without hyperlink

%3CLINGO-SUB%20id%3D%22lingo-sub-769276%22%20slang%3D%22en-US%22%3ECreate%20a%20navigation%20heading%20node%20without%20hyperlink%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-769276%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20create%20a%20navigation%20node%20through%20code%20using%20either%20REST%20directly%20or%20PNP%20that%20is%20just%20a%20heading%20without%20a%20hyperlink%2C%20but%20am%20unable%20to.%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anyone%20have%20a%20code%20sample%20for%20just%20creating%20Headings%20to%20navigation%20elements%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-769276%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-772947%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20navigation%20heading%20node%20without%20hyperlink%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-772947%22%20slang%3D%22en-US%22%3EHi%20Mark%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20have%20been%20struggling%20with%20this%20too%20in%20the%20past.%20The%20only%20workaround%20I%20know%20about%20is%20passing%20%22javascript%26amp%3Bcolon%3Breturn%20false%3B%22%20as%20the%20URL%20for%20you%20navigation%20node.%20This%20effectively%20doesn't%20take%20user's%20to%20another%20location%20when%20navigation%20node%20is%20clicked%2C%20but%20the%20%22hand%20icon%22%20still%20appears%20when%20hovering%20over%20the%20node%20(this%20is%20not%20the%20case%20with%20a%20%22real%22%20Heading)%3CBR%20%2F%3E%3CBR%20%2F%3EServer-side%20this%20was%20controlled%20by%20setting%20property%20bag%20values%20on%20the%20SPNavigationNode%20(navigationNode.Properties%5B%22BlankUrl%22%5D%20%3D%20%22True%22)%2C%20but%20setting%20these%20is%20not%20available%20through%20remote%20API's.%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20this%20helps%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-779219%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20navigation%20heading%20node%20without%20hyperlink%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-779219%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Paul!%20This%20is%20unfortunate.%20I'll%20try%20your%20workaround%20to%20see%20if%20it%20still%20works!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-779279%22%20slang%3D%22en-US%22%3ERe%3A%20Create%20a%20navigation%20heading%20node%20without%20hyperlink%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-779279%22%20slang%3D%22en-US%22%3E%3CP%3EPlease%20note%20the%20TechCommunity%20text%20editor%20encoded%20the%20URL%20you%20should%20use%2C%20I'm%20unable%20to%20find%20out%20how%20to%20let%20it%20render%20properly%20but%20there%20should%20be%20a%20colon%20(%20%3A%20)%20between%20%22javascript%22%20and%20%22return%20true%3B%22%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I'm trying to create a navigation node through code using either REST directly or PNP that is just a heading without a hyperlink, but am unable to. 

Does anyone have a code sample for just creating Headings to navigation elements?

3 Replies

Hi Mark,

I have been struggling with this too in the past. The only workaround I know about is passing "javascript:return false;" as the URL for you navigation node. This effectively doesn't take user's to another location when navigation node is clicked, but the "hand icon" still appears when hovering over the node (this is not the case with a "real" Heading)

Server-side this was controlled by setting property bag values on the SPNavigationNode (navigationNode.Properties["BlankUrl"] = "True"), but setting these is not available through remote API's.

Hope this helps

Thanks Paul! This is unfortunate. I'll try your workaround to see if it still works!

Please note the TechCommunity text editor encoded the URL you should use, I'm unable to find out how to let it render properly but there should be a colon ( : ) between "javascript" and "return true;"