How To Change Page Layout In SharePoint Online

Modern SharePoint pages can be configured with three different page layouts,

  • Home Page Layout
  • Article Page Layout
  • Single Part App Page Layout

Home Page Layout

  • Used by default on the site home page
  • Used in the landing page of a modern site
  • Page layout without the top-banner section (page title and header image)

Article Page Layout

  • Used by default on the modern pages
  • Page with the top-banner section

Single Part App Page Layout

  • The page where the top-banner section is hidden
  • Cannot be edited by end-users using browser (Command bar is hidden)
  • Supports hosting only a single web part or Microsoft Teams application

Below is the PNP PowerShell script to change the Page Layout,

Write-Host "Enter site collection URL:"
$siteCollectionURL = Read-Host
 
Write-Host "Enter page name:"
$PageName = Read-Host
 
Write-Host "Choose the page layout:"
        
Write-Host "1 - Home"
Write-Host "2 - Article"
Write-Host "3 - Single Web Part App"
$choice = Read-Host


if($choice -eq "1"){
    $choice = "Home"
}elseif($choice -eq "2"){
    $choice = "Article"
}elseif($choice -eq "3"){
    $choice = "SingleWebPartApp"
}
 
Connect-PnPOnline -Url $siteCollectionURL  
Set-PnPClientSidePage -Identity $PageName -LayoutType $choice

Summary

In this blog, you learned how to change page layout in SharePoint Online using PNP Powershell. I hope this blog helps :)