I currently have JavaScript that sets the navigation, however it currently sets it to:

"Structural Navigation: Display the current site, the navigation items below the current site, and the current site's siblings"

I cant seem to get it to set to:

"Structural Navigation: Display only the navigation items below the current site"

We are using a SharePoint Online environment and we have built the JavaScript into the page layout.

This is the code I currently have:


    var scriptBase = _spPageContextInfo.webAbsoluteUrl + "/_layouts/15/";   

    $.getScript(scriptBase + "sp.runtime.js",function(){

        $.getScript(scriptBase + "sp.js",function(){

            $.getScript(scriptBase + "sp.publishing.js", modifyNavigation);


function modifyNavigation(){

    var context = SP.ClientContext.get_current();

    var currentWeb = context.get_web();     

    var webNavSettings = new SP.Publishing.Navigation.WebNavigationSettings(context, currentWeb);

    var navigation = webNavSettings.get_currentNavigation(); 




        console.log("Navigation set");  





With this code I end up with the following result: Navigation

Is it possible to have the code set the bottom radio button?

1 Answer 1


Not sure if that's still actual, but I found the solution to this problem.

In addition to setting the WebNavigationSettings.CurrentNavigation.Source to "PortalProvider", which you do in your code by calling


you also need to update the property "__NavigationShowSiblings" of the web object.

e.g. in PowerShell you can do this (and it works):

$web.AllProperties["__NavigationShowSiblings"] = "False";   

In JSOM I think you could do something like this (haven't tried but found the snippet)

var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
this.properties = web.get_allProperties();
this.properties.set_item("__NavigationShowSiblings", "False");

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.