SharePoint top navigation bar helps users to navigate to other sites. Top Navigation is also referred to as Global Navigation because it remains the same throughout the site collection. However, subsites can be configured in a way so that the top navigation does not come up in the top bar. We will have to enable publishing feature to work on the top navigation bar as it comes bundled with it.

hol

Top navigation can be of two types.

Structural navigation is a navigation based on the site structure and the links will redirect to other sub sites, whereas, Metadata Navigation was introduced in SharePoint 2013 and is based on metadata terms defined in the taxonomy store. We can assign redirection URLs to the terms during their creation which can later be used in the top navigation.

Top Navigation can be configured by going to the Site Settings -> Navigation location.

Navigation

In this article, we will see how we can add new navigation nodes to the top navigation bar using JavaScript Object Model.

Internal Implementation

Let’s see how we can implement it in SharePoint. Save the above scripts onto a text file and upload it to Site Assets library.

SharePoint Implementation

Summary

Thus, we have seen how we can modify the top navigation bar programmatically using JavaScript Object Model .This has been tried and tested out in SharePoint 2016 and Office 365.