How To Create Modern Page In SharePoint Site Using PnP PowerShell

In this blog, we are going to see how to create a new modern Site Page in SharePoint site using PnP PowerShell.
 
Add-PnPClientSidePage command from PnP PowerShell will do the creation of a new modern page in SharePoint site.
 
Modern site page is created by using any one of the below two ClientSidePagelayoutTypes,
  • Home
  • Article

Create Article layout modern page

The below PowerShell command is used to create a modern article page in a SharePoint site.
  1. PS:> $cred = Get-Credential  
  2. PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. PS:> Add-PnPClientSidePage  -Name “Article Page”  
The page URL will be https://<tenant>.sharepoint.com/sites/dev/sitepages/article page.aspx

 
Output 

By default, Add-PnPClientSidePage creates an Article layout type. To create the Home layout type, we have to pass the Home as a LayoutType parameter.

We can also use the below command to create the same page without providing a –Name parameter 

By default, Add-PnPClientSidePage creates an Article layout type. To create Home layout type, we have to pass the Home as a LayoutType parameter.

We can also use the below command to create the same page without providing the –Name parameter.
  1. Add-PnPClientSidePage  “Article Page”  

Create Home Layout Modern Page

The below PowerShell command used to create a home layout modern page in SharePoint Site Pages library.
  1. PS:> $cred = Get-Credential  
  2. PS:> Connect-PnPOnline -Url https://<tenant>.sharepoint.com/sites/dev -Credential $cred  
  3. PS:> Add-PnPClientSidePage  -Name “Home Page” -LayoutType Home  
 

The Page URL will look like: https://<tenant>.sharepoint.com/sites/dev/sitepages/home page.aspx
 
Output