M365 – Remove Page Header or Image Banner From SharePoint Online Pages

Hi Everyone,
Recently I was working on SharePoint Online project and needed creation of some site pages in the site. So, I started creating pages but SharePoint creates all the modern pages with page headers or image banner. As shown in the image below.

There is a way to remove the page header using pnp powershell. Let’s see how it can be done. We will connect to SharePoint online -> list out all the pages from site pages library -> and change the property “PageLayoutType” of the page which is nothing but the list item.
See below steps:
- Open Windows PowerShell ISE.
- Run following commands one by one.
- Connect to SharePoint Online.
Connect-PnPOnline https://<your-tenant-name>.sharepoint.com/sites/<sitename>
4. Get the list of all pages from Site Pages
Get-PnPListItem -List SitePages

5. Change the Page Layout from “Article” to “Home”, here replace <List-Item-Id> with the Id of the list item we got in the last step.
Set-PnPListItem -List SitePages –Identity 10 -Values @{"PageLayoutType"="Home"}

After this command is executed go back to SharePoint site and refresh the page. The page header or image banner is gone..

Thanks a lot for reading.
You must log in to post a comment.