
When creating a new page a header with the title of the page will be shown to the user. In the current days, it’s not possible to remove that header from the page using the SharePoint interface. Today, we will share a PowerShell that allows you to remove that area from the page and some article that you can use with different options.
Replace the variable below with your own and you will have a page without the title header.
$PageName = "PageName"
$LoginUrl = "https://contoso.sharepoint.com/sites/siteName"
Connect-PnPOnline -Url $LoginUrl -UseWebLogin
Set-PnPClientSidePage -Identity $PageName -LayoutType Home
If you intend to remove from all the SitePages use this code, but before you do to all of the Site Pages, I would recommend making some backup. You can use the approach of this article for this.
$LoginUrl = "https://contoso.sharepoint.com/sites/siteName"
Connect-PnPOnline -Url $LoginUrl -UseWebLogin
$pages = (Get-PnPListItem -List SitePages).FieldValues
foreach($page in $pages){
Set-PnPClientSidePage -Identity $page.FileLeafRef -LayoutType Home
}
Conclusion
This is a possible approach for this case but there are other possibilities to achieve. Check below link (techmikael) to create an option inside SharePoint to have this option inside the properties of the page. There is also an extension for Google Chrome (Chrome-SP-Editor) which you can use to remove this option. The option used for that case is instead of using the option to remove the header, they use the Page Layout Home.
Useful info. Thanks David!
[…] is always my starting point when I’m looking for alternative ways to modify SharePoint. My friend David Ramalho also wrote an article related with the modern SharePoint page layouts and it was my inspiration for […]
This can now be achieved by using a PnP Provisoning template
the key is the Layout=”Home” attribute
How would you go about if you would like to reverse this? I have a case where the header area is gone (don’t know how) and I want to put it back.
Hi Niclas,
In the PowerShell script, you just need to change the layout from Home to Article. If you switch to repost, it’ll clear all the web parts on the page so be careful with this change.
Set-PnPClientSidePage -Identity $PageName -LayoutType Article
Thanks, David!
Thanks a lot
I am looking to have banner but hide tittle on the banner. Can you please help ?
Hi,
Unfortunately, there is no option to make this type of customization. If you want to have something similar add the image webpart to the top of the page and hide the banner area. This may work for your scenario.
My best,
David Ramalho
Hi David. It’s useful, very thanks.
My issue is, to do logo and title not clickable or edit url to another site. How can I do it?
I have SP modern site
Hi,
Unfortunately, it’s not possible to change the site logo URL on Modern sites.
My best,
David Ramalho
Hello, i’m getting an error
the url is this:
https://mydomain.sharepoint.com/sites/intraPol/SitePages/Find%20Me/Find-Me.aspx
i get this error
Set-PnPClientSidePage : Cannot contact site at the specified URL
https://mydomain.sharepoint.com/sites/intrapol/sitepages. There is no Web named
“/sites/intrapol/sitepages/_vti_bin/sites.asmx”.
At line:5 char:1
+ Set-PnPClientSidePage -Identity $PageName -LayoutType Home
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Set-PnPClientSidePage], ClientRequestException
+ FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.ClientSidePages.SetClientSidePage
Hi,
Not sure what could be problems, I would try replacing the %20 in the Find%20Me with space.
https://sharepoint-tricks.com/wp-admin/edit-comments.php#comments-form
My best,
David Ramalho