SharePoint Hacks – Modern Experience

The modern experience is a welcome addition to the SharePoint platform. The user experience is elegant and works well on desktop and mobile platforms. The modern experience comes “out of the box” with all SharePoint Online provisioned Communication and Team sites.

For those of us with legacy “Classic” sites the option to “upgrade” is available through “Site Pages”.

One issue that keeps coming when we upgrade to modern is the over-sized title banner and accompanying white space. See images below – out of the box modern experience vs modern experience upgrade.

ModExp-Banner1

Site Pages have a default page layout type of “Article”. When upgrading a Classic site to the modern experience you replace the default home page with the new Site Page. The Article layout includes the over-sized banner and white space.

To work around this issue you can use PowerShell to change the page layout to “Home”. The Home layout does not include the title banner and white space. You could also use SharePoint Designer but for this blog posting I am sticking with PowerShell and PnP cmdlets.

# 1 - Connect to your site
$UserName = "Your user name"
$UserCredential = Get-Credential -UserName $UserName -Message "Type your password."
$SiteURL = "Your site URL"
Connect-PnPOnline -Url $SiteURL -Credentials $UserCredential

# 2 -Determine your target page ID
Get-PnPListItem -List SitePages

#3 - Change page layout using the target page ID
Set-PnPListItem -List SitePages -Identity 3 -Values @{"PageLayoutType"="Home"}

ModExp-PS1

See the results pictured below.

ModExp-Banner2

Thanks for stopping by.

NY

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s