Thursday, June 15, 2017

How to remove the banner on modern pages from the UI

I have previously written about how to change the layout type of a modern page using PnP PowerShell in order to get rid of the huuuuge top banner. Yes,  I know Microsoft is in the works of adding functionality to the UI to allow header changes, but until that happens I figured I’d show a way to accomplish the same for a Power User.

The layout of a modern page is handled by a column named Page Layout Type (PageLayoutType), and it’s part of a sealed content type named Site Page.

You cannot modify a sealed content, and the Page Layout Type column is hidden, so we need a tiny bit of trickery to get this working.

In your site, navigate to site settings, and to site site content types. Or tack /_layouts/15/mngctype.aspx at the end of the URL to go there directly.

Create a new content type named My Site Page which inherits from the Site Page content type.

image

Copy the content type id from the URL in your browser and create the following URL:

https://contoso.sharepoint.com/teams/modernisthenewmodern/_layouts/15/ManageContentTypeField.aspx?ctype=0x0101009D1CB255DA76424F860D91F20E6C411800FA0F5B1F8210094AB33AED9F195597A5&Field=PageLayoutType

On the column screen, make no changes, just hit OK. This will make the column visible later. Next, navigate to the Site Pages library and go to library settings and add the previously created content type.

image

You are now ready to create your site or news page. Once the page is created and saved:

  • navigate back to the site pages library
  • select the page you created
  • click the information icon
  • change the content type to My Site Page

You will now see the Page Layout Type column visible. Change the value from Article to Home, and the banner is gone. You can change the content type back to Site Page after you have changed the layout to ensure any search based experience relying on the base type is still working.

image

Look ma, no banner!

image

Summary

Once set up, you can per page change the content type to your custom one and change the layout to get rid of the banner. It’s somewhat convoluted, but it is doable from the UI :)

7 comments:

  1. Thanks for the post it works like charm. I have a follow up question about layouts for modern pages. Is there a way to create modern news pages with pre configured layout and web parts. Scenario: When users click on News Post in a communication site then instead of seeing a blank page they see three text web parts with descriptive titles and a people web part.

    ReplyDelete
    Replies
    1. If you click the "+ News ↓" and pick "Page" you can pick between three layouts. Then you can promote the published page as news afterwards.

      Your other option is to navigate to a post/page and click New->Copy of this news post.

      At Ignite Microsoft had page layouts on the roadmap for H12018, which means layouts should be coming - but right now you need to work around this.

      Delete
    2. Hello,

      I'm facing a problem in modern design site page, but not in team site : it's in a classic spo site.

      Excuse my dust but i've tried to remove "teams" form the url given in this howTo: https://contoso.sharepoint.com/teams/modernisthenewmodern/_layouts/15/ManageContentTypeField.aspx?ctype=0x0101009D1CB255DA76424F860D91F20E6C411800FA0F5B1F8210094AB33AED9F195597A5&Field=PageLayoutType

      Unfortunately it doesn't work...


      Well, my main problem is that, idk why and Microsoft support doesn't know too, PageTitle section give my users an error "Duplicate web part id not allowed" when they access a teamsite, then get back to the home page with a link "https://contoso.sharepoint.com". That's why i'd like to totally remove it, and hide the error, or better, using your tips :)

      Delete
  2. Love this post mate... just with the visibility of columns was picked up using get-pnpprovisioningtemplate :-) I just tested now and while the new CT is there, the column remains hidden...

    ReplyDelete
  3. Can a method like this be used to hide the SEARCH from a modern page? I want to use communication sites on the front of an intranet, but the search is contained to the immediate site with no way to change to "all sites" or hide it.

    ReplyDelete
    Replies
    1. Look at https://n8d.at/blog/remove-feedback-buttons-from-sharepoint-footer-through-application-customizer/ but you decide if it's smart or not :)

      Delete