none
Customize top navigation bar RRS feed

  • Question

  • Hi,

    I'm facing a problem with SharePoint javascript customization,

    I want to add terms from termstore in SharePoint top navigation bar with javascript. For this i request a navigation termset to get all needed terms ( parent and child ) and then I add those term in top navigation bar like this :

                    nnci = new SP.NavigationNodeCreationInformation();
                    nnci.set_title(parent.get_name());
                    nnci.set_url(parent.get_localCustomProperties()._Sys_Nav_SimpleLinkUrl);
                    nnci.set_asLastNode(true);
                    navigationNodeCollection.add(nnci);

    Everything works fine and I have my terms in the top navigation bar. The problem appears when I activate SharePoint Server Publishing Infrastructure feature. When this feature is activated,  if the URL is empty at this step :

    nnci.set_url(parent.get_localCustomProperties()._Sys_Nav_SimpleLinkUrl);

    It's not displayed in UI of SharePoint.

    But when I check the content of the top navigation bar object in the console, I see the term with empty URL.

    Any Idea ?

    Thanks.

    Wednesday, February 1, 2017 2:43 PM

All replies

  • Hi Alex,

    i have a simple question... are you trying to create this with javascript?

    https://www.habaneroconsulting.com/insights/Term-based-navigation-in-SharePoint-2013#.WJMEWPnhCUk

    SharePoint has term based navigation feature out of the box.

    Best regards.

    Thursday, February 2, 2017 10:07 AM
  • Hi,

    I know this, the problem is that the term based navigation works for only one site collection.

    I want to do it for every site collection, then I just have to modify the termstore and the navigation is updated everywhere.

    Best regards.

    Thursday, February 2, 2017 10:11 AM
  • After testing, the problem is not when the URL is empty.

    The problem appears because when the SharePoint Server Publishing Infrastructure feature is activated, there is a link to the welcome page in the top navigation bar. If I have a term in my termset with the same URL that this default link, it doesn't appear in the top navigation bar.

    Is it possible to delete the welcome page link in the to navigation bar ?

    Thank you.

    Thursday, February 2, 2017 10:34 AM