Friday, May 12, 2017

How to remove the banner on modern pages using Office PnP PowerShell

image

While we’re waiting for full support for modern pages and how they work in Office PnP and the SharePoint Framework, here’s how you turn off the banner on article pages – basically setting them to the layout used by the Office 365 Group Team sites.

If you want to turn the banner back on, set the PageLayoutType to “Article”.

# Connect to the site
Connect-PnPOnline https://tenant.sharepoint.com/sites/portal

# List all pages, and find the id of the modern page
Get-PnPListItem -List SitePages

# Change layout from "Article" to "Home" to remove top banner
Set-PnPListItem -List SitePages –Identity <id> -Values @{"PageLayoutType"="Home"}

image