
Creating a subsite
SharePoint lets you create subsites under existing sites. Subsites are useful when you want to organize content through a subset of lists, libraries, or pages but the audience that will have access to this content is the same or a subset of the users of the parent site. For example, a large organization might have a site for the HR department, and they are likely to have a payroll subsite within it for a small set of members that help manage the organization's payroll.
This recipe shows you how to create a subsite using the modern Team site template.
Getting ready
You need Full Control access to the site that you would like to create the new subsite for.
How to do it...
To create a subsite, follow these steps:
Browse to the site that you would like to create the subsite for.
Click on the Settings gear icon in the top-right corner and then Site contents.
Click New and then Subsite.
On the New SharePoint Site page, enter or select the following:
A title, description, URL name, language, and template for your site.
Whether or not the site will use the same permissions as the parent site. Clicking Use unique permissions will let you specify permissions that are different from that of the parent site.
Whether or not the site will show up on the Quick Launch of the parent site (typically set toNo).
Whether or not the site will show up on the Global Navigation of the parent site (typically set toYes).
Whether or not the site will use the same Global Navigation as the parent site(typically set to Yes):

Click the Create button once you have finished setting this up or confirmed the information you provided here.
Congratulations! You just created your new subsite.
How it works...
For reasons beyond the scope of this book, the general guidance from Microsoft at the time of writing is to not create subsites. Microsoft recommends creating sites (that is, site collections) instead to accomplish your goals and using a hub to connect related sites. Having said that, subsites may still make sense in some scenarios. One such scenario was described at the onset of this recipe with the HR site and the payroll subsite. Another example could be a temporary collaboration area within a "Research" Team site, for a smaller team to collaborate on a new idea or upcoming product. Here is some good independent guidance on the pros and cons of each: https://m365book.page.link/Why-Subsites and https://m365book.page.link/Why-Sites
At the time of writing, the maximum number of subsites that you can have within a SharePoint site collection is 2,000. On the other hand, the maximum number of site collections per organization tenant is 2 million.
There's more
In the topics in this section, we will look at how to use custom site provisioning to create SharePoint sites that contain extended or custom capabilities right off the bat, as soon as they are created. We will then look at the concept of using templates to replicate the structure, design, and features of your favorite SharePoint sites.
Custom provisioning using Site Designs and Site Scripts
SharePoint lets you create sites that use a customized provisioning experience tailored by you for your users. You can accomplish this using site designs and site scripts. A site-design is a collection of site scripts that let you provision your designs and customizations as part of the site creation experience. These designs and customizations can include reusable lists, themes, layouts, pages, or custom actions so that your users can quickly build new SharePoint sites with the features they need. Site designs are useful in helping drive consistency across your sites. You can apply site designs while creating a site, as shown in the following screenshot:

For existing sites, you can apply site designs by clicking on the gear icon and then clicking Site designs, as shown in the following screenshot:

Creating site scripts and site designs is an advanced capability and will require administrative and development expertise to accomplish it. The following Microsoft Docs article and sub-articles provide a detailed walk-through of implementing and using site scripts and site designs in your organization: https://m365book.page.link/Site-Designs.
Reusing a site as a template
You may, however, need to recreate the functionality, designs, structure, and/or some or all of the content of an existing site. The way you would go about doing so in the classic SharePoint experience was by saving the site as a template and then creating new sites using that template. This capability, however, is now deprecated in the modern SharePoint experience.
There are two ways to export existing sites as templates in the more modern experience, and we will look at both here.
Exporting a site using a site script
Site designs and site scripts allow you to create sites using a complex and customizable provisioning experience. They are a great way to create standardized sites from scratch. You can also use site scripts to export your existing site and its settings so you can use the generated script to create a new site.
Please refer to the Get-SPOSiteScriptFromWeb command here to export your site as a script: https://m365book.page.link/Get-SPOSiteScriptFromWeb.
Once the site is exported as a script, you can use it in a site design for users to create a new site based on that template. We also discussed site designs and site scripts in the previous topic on Custom provisioning using Site Designs and Site Scripts.
In addition to using PowerShell for site designs and site scripts, you can also use the Microsoft 365 Rest API to carry out the same tasks, as described here: https://m365book.page.link/SiteDesign-RestAPI.
Exporting a site using PnP provisioning
The PnP engine has made developer and admin commands available that can be used to save a site of your choice as a template. You can then optionally make changes to thefeatures of the saved site template and then use similar PnP commands again to provision one or more sites using the saved template.
You can use the Get-PnPProvisioningTemplatecommand to export the site as a template, as described here: https://m365book.page.link/Get-PnPProvisioningTemplate.
You would then use the Apply-PnPProvisioningTemplatecommand to use this template to create a new site: https://m365book.page.link/Apply-PnPProvisioningTemplate.
You can read more about the PnP provisioning engine and its templating capabilities here: https://m365book.page.link/PnP-Provisioning-Engine.
See also...
The Creating a modern site recipe in Chapter 2, Introduction to SharePoint Online
The SharePoint PnP topic in the Office Development Frameworks section of the Appendix