Creating a Modern Home Page for the Root Site in a Tenant
The successful approach below has made it into the official Microsoft docs in the article Customizing the “modern” experiences in SharePoint Online.
tl;dr It would be great to create a modern home page for the classic root site of an Office 365 tenant. You can’t.
This is another case where I would love to be proven wrong, of course. Today I was trying to figure out some sort of cheat to make this happen.
I was wrong! As Paul Youngberg pointed out in the comments and Mikael Svenson (@MikaelSvenson) shared on Twitter, there is a way to do this with Powershell. Read below…
The conversation was interesting and I got quite a few good suggestions, but sadly none of them worked.
It’s easy to create a modern page in the classic root site. That page, however, has the large header we get with that type of page. We can remove the image, but we’re still stuck with the title space – even if we leave it blank. Site home pages, on the other hand, do not have that header. There may be other distinctions between those two page types, but I’m not sure what they are.
Does anyone know of any documentation showing other differences between the two page types?
I created a UserVoice for this: Allow us to create a modern home page for the classic root site.
Until we can make the root site of a tenant into a modern site, please allow us to create a headerless modern home page to replace the existing classic home page.
I discussed some ideas on how to think through where your Intranet should go in my previous post:
Ideally, we’d just be able to convert the root site to a Communication Site and be done with it, but that’s more complicated and not available yet. (Some people have come up with ways to hack a Comms Site into place, but it’s not supported and I don’t recommend it.)
I did try a few things to get myself a modern home page:
- Tried to copy a home page from a Team Site and/or a Communications Site – no joy. Even this wasn’t easy. I had to copy the Home.aspx page into the Documents library in the source site to download it and then try to upload to the root sites’s Pages library. When I tried to upload, I got an access violation, even though I’m a Site Collection Admin and Global Tenant Admin. (Thanks to Beau Cameron [@Beau__Cameron] for this suggestion.)
- André Salomons (@SmartSharePoint) said he had luck by removing the root Site Collection and creating it anew, giving him a modern home page. Unfortunately, I didn’t see the same thing – I just another good old classic Site Collection.
I think the realistic choices at this point are:
- Pretty up the classic page using our tried and true techniques. That may mean custom HTML and CSS in a Content Editor Web Part, for example.
- Use a regular modern page, remove the image, and use the title to say something like “Welcome to the Intranet”. Leaving the title blank gets you big white space, so it makes more sense to me to have a title.
My pal John Sanders (@JohnSanders) at Microsoft spotted my tweets and asked:
That would be a step in the right direction, but I come back to my question above about what other differences there may be between the two page types.
I’m certain this is a temporary problem. They will come up with a way to make the root site modern, by hook or by crook.
After I published this, several people pointed out a way to accomplish what I wanted using Powershell. See Paul Youngberg’s comment below or check out Mikael Svenson’s blog posts:
- How to remove the banner on modern pages using Office PnP PowerShell
- How to reset a modern home page using PnP PowerShell
Using Mikael’s posts as the roadmap (Paul gave the same first step), I was able to create a new modern home page for my root Site Collection.
You should read Mikael’s posts, but here are the basic steps:
- Create a new modern page in the site and set it as the home page. Be sure to give it a title because you’ll need to identify it in step 2.
- Run the Powershell to convert the page from the Article type to the Home type.
- If you’d like to have the default content in the home page, run the Powershell to reset the content to the defaults.
Here’s the Powershell for Step 2 above, from Mikael’s post.
# 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"}
When you run this Powershell, you’ll use the id for the page you created in the Get-PnPListItem step to provide the -Identity value in the last step.
If you want to reset the page to what home pages have in them by default, run this Powershell from Mikael’s second post:
Connect-PnPOnline https://<tenant>.sharepoint.com/sites/mysite
# Get welcome page url
$web = Get-PnPWeb -Includes WelcomePage
# Load the page
$file = Get-PnPFile -Url $web.WelcomePage
# Get the page's item
$item = $file.ListItemAllFields
# Load the item id
Get-PnPProperty -ClientObject $item -Property Id
# Clear the content to reset
Set-PnPListItem -List SitePages -Identity $item.Id -Values @{"CanvasContent1"=$null} -SystemUpdate
After these two steps, you have a default modern home page as the home page for your root Site Collection!
Even better, if you want your new home page to look more like a Comms Site home page, you can turn off the Quick Launch in the Site Settings (Navigation Elements at /_layouts/15/navoptions.aspx).
I’ve had a modern home page on our classic site for a little over a year now, thanks to the SharePoint PnP toolkit: https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps. Definitely possible.
Get Creds
$creds = Get-Credential
Connect to the site:
Connect-PnPOnline -credential $creds 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 large top banner:
Set-PnPListItem -List SitePages -Identity -Values @{“PageLayoutType”=”Home”}
Did you check the Add-PnPClientSidePage cmdlet and setting the layout type directly?
This should work on classic sites as well. Same for PnP Provisioning template.
Awesome…I’d been stuffing around for hours with the other suggestions and this solved it in 15 seconds…cheers!
If you’re brave, you can fire up SharePoint designer, edit the page in Advanced Mode and near the top find the setting mso:PageLayoutType. You will find it is “Article”. Change it to “Home”, save it and the header will be gone.