Set up a site template for your hub site
A site template is one or more site scripts that Microsoft SharePoint runs when a site is associated with a hub site. Actions describe changes to apply to the new site, such as creating a new list or adding nodes to the site navigation. Site templates provide reusable lists and custom actions so your users can quickly get started with the features they need.
Note
For organizations using Multi-Geo Capabilities in Microsoft 365, hub site templates work only when sites are in the same geo location as the hub site.
Note
These instructions require a SharePoint Administrator or above in Microsoft 365.
1. Create a JSON script, add it, and create the site template
Follow the steps in Get started creating site templates and site scripts. For the full list of supported actions, see Site template JSON schema. Note that when you create the site template, the site template you provide ("64" for team site or "68" for communication site) doesn't matter.
2. Scope access to the hub site template
When a site template is first created, it is available to everyone. You can grant View rights to the site template. After rights are granted, only the users or groups (principals) specified have access. We recommend granting access to the same principal used to scope the hub site.
Grant-SPOSiteDesignRights
-Identity <ID>
-Principals ("HR@contoso.sharepoint.com")
-Rights View
Replace <ID> with the site design ID from when you added the site script.
3. Set your site template for the hub site
You can set the hub site template in two ways. You can do it using the following PowerShell command:
Set-SPOHubSite https://contoso.sharepoint.com/sites/Marketing
-Title "Marketing Hub"
-LogoUrl https://contoso.sharepoint.com/sites/Marketing/SiteAssets/hublogo.png
-Description "Hub for the Marketing division"
-SiteDesignId "<ID>"
Replace <ID> with the site script ID from when you added the site script.
You can also let hub site owners set the hub site template by using a new option available in the UI. For info about the hub site settings available to site owners, see Set up your SharePoint hub site.