Remove Header Image Banner From SharePoint Modern Pages

Introduction 

SharePoint Online Modern pages have header image banners in all modern pages, (i.e., Communication or Team Sites.) The header image banner needs a background image or text, takes up almost 40% of the page, and furthermore, we can’t remove this section using UI.
 
Remove Header Image Banner From SharePoint Modern Pages

If you want to turn this section ON or OFF, it is possible using PnP PowerShell command. Basically, it allows us to change the page layout from Article to Home. The homepage layout doesn’t have a header image banner section.

Remove the Header Image Banner Section

Open SharePoint Online Management Shell and run the below command in sequence.

  1. # Connect to the site  
  2. Connect-PnPOnline https://mittal1201.sharepoint.com/sites/teamsite  
  3. # List all pages, and find the id of the modern page  
  4. Get-PnPListItem -List SitePages  
  5. # Change layout from "Article" to "Home" to remove top banner  
  6. Set-PnPListItem -List SitePages –Identity <id> -Values @{"PageLayoutType"="Home"}  

If an issue occured with Connect to the Site using PnP Command, you can use  "-UseWebLogin" parameter. It will prompt via browser to validate and connect with SPO.

Screenshot for your reference.
 
Remove Header Image Banner From SharePoint Modern Pages
 

After executing this command, refresh the page. You will not find the header image banner.

 
Remove Header Image Banner From SharePoint Modern Pages

Happy Coding.