SharePoint Online Hub Sites

In this blog post, we will learn about SharePoint Online Hub Sites.

What is a SharePoint Hub Site ?

SharePoint Hub Site allows to associate different sites to it and let users search and discover content from all of the associated sites. It also implements common top navigation bar and branding across associated sites.

How to create a SharePoint Hub Site ?

Actually there is no way to create a Hub Site. Instead, any site can be registered as Hub Site. It is preferred to register a Communication site as a Hub Site.

There are two ways to perform this action-

  • Using PowerShell – We can use below PnP PowerShell command to register a Hub Site.

Register-PnPHubSite -Site “<Site URL of existing site>”

  • Using REST API – We can send POST request to register a site as Hub Site
function RestRequest(url,params) {
   var req = new XMLHttpRequest();
   req.onreadystatechange = function ()
      if (req.readyState != 4) // Loaded

   // Prepend web URL to url and remove duplicated slashes.
   var webBasedUrl = (_spPageContextInfo.webServerRelativeUrl + "//" + url).replace(/\/{2,}/,"/");"POST",webBasedUrl,true);
   req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
   req.setRequestHeader("ACCEPT", "application/json; odata.metadata=minimal");
   req.setRequestHeader("x-requestdigest", _spPageContextInfo.formDigestValue);
   req.send(params ? JSON.stringify(params) : void 0);

RestRequest("/_api/site/RegisterHubSite", null);

Normal Communication Site


After registration-


Notice the new top navigation bar and new Hub Site Settings option added. “Hub Site Settings” option can be used to set navigation logo and update navigation name for link (see changes in below screenshot and compare with above screenshot).


How to associate / join a site to a Hub Site ?

There are four ways to join a Site to a Hub Site –

  • Using UI – Navigate to the target site, click on gear icon and select “Site Information”. “Hub Site Association” dropdown displays available Hub Sites, select one to join and click “Save” button.


  • Using PowerShell – Run below command to associate / join target site to Hub Site.

Add-PnPHubSiteAssociation -Site “<Target Site URL>” -HubSite “<Hub Site URL>”

  • Using REST API – We can send a POST request to join target site to Hub Site.

RestRequest(“/_api/site/JoinHubSite(‘d8ab01e9-1634-44dd-91fe-1e6ff8385c34’)”, null);

  • Using Site Scripts – Use below JSON to create Site Script that allows to join the existing sites or new site to Hub Site.

    “verb”: “joinHubSite”,
    “hubSiteId”: “<Hub Site ID>”

Run below command to list down existing Hub Sites along with Title and Site ID.


After joining to Hub Site, following changes are applied to target site-

  1. Top navigation link to Hub Site is added.
  2. Hub Site branding is applied.
  3. Navigation from Hub Site is inherited. (Note: This may take some time to reflect.)


Now in Hub Site top navigation, you can add a link to your associated site. (This is not done automatically.)


On Hub Site, perform a search, results will have content from both Hub Site and associated sites. But results are also filtered based on user permission means only that content will be returned which user has permissions to at least view.


How to remove association of a site from a Hub Site ?

There are three ways to remove association of a Site from a Hub Site –

  • Using UI – Navigate to the target site, click on gear icon and select “Site Information”. “Hub Site Association” dropdown displays available Hub Sites, select “None” and click “Save” button.
  • Using PowerShell – Run below command to de-associate a site from hub Site

Remove-PnPHubSiteAssociation -Site “<Site URL>”

  • Using REST API – Catch here is send POST request to JoinHubSite method but with Site Id “00000000-0000-0000-0000-000000000000”

RestRequest(“/_api/site/JoinHubSite(‘00000000-0000-0000-0000-000000000000’)”, null);

Notice the changes after removing association in target site.

How to de-register a SharePoint Hub Site ?

This allows to revert a Hub Site to a Team or Communication Site. This can be done in two ways-

  • Using PowerShell – Run below command to un-register a site.

Unregister-PnPHubSite -Site “<Hub Site URL>”

  • Using REST API – Send below POST request to un-register a site.

RestRequest(“/_api/site/UnRegisterHubSite”, null);

Few things to consider-

  • At a time only one site can be associated to a Hub Site
  • User creating/registering a Hub Site must be a “SharePoint Administrator”.
  • Minimum role required by user to associate a site to Hub site is “Site Owner”.
  • There is a limit of 50 hub sites that can be created for an organization but there is no limit on association of sites to a hub site.
  • Association of a site to a hub site does not impact permission either on site or the hub site. Permissions for both the site are maintained separately.
  • Any site associated to a Hub Site cannot be registered as a Hub Site.
  • If a classic Team site is registered as a Hub Site, then hub navigation and hub site settings option appears only on Modern pages.

Upcoming Features-

Following are some of the upcoming features which are in development as per the Office 365 Roadmap-

  • Flexible approval process that allows Site Owners to make requests and programmatically adapt to changes.
  • Site Scripting during Site association to enforce permissions, content management, brand elements or add policies
  • Flexibility to adhere to preferred theme and brand colors across more aspects of the site or pages.
  • Unique “hub layout” in the news web part
  • Use Flow to approve hub site joins


Please let me know your views or feedback in comments.


3 thoughts on “SharePoint Online Hub Sites

  1. Nice article
    One question though… If we have big units in an organisation and they want some common theme and some specific to their units, how the hub structure should be laid. Given the fact that each unit will have their own teamsites created.

    Liked by 1 person

    • Hi Prawasini,

      First of all thanks for the feedback. Now for the question, the purpose of Hub Site is to organize or group a set of different site collections. The concept of common theme across the hub site and associated sites is introduced to maintain a consistent look and feel.

      In other words, at least currently it is not possible to have different theme for some of the sites connected to a hub site.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s