Forum Discussion
Enable modern site pages
In my tenant i have several site collcetions, but for some of them i cant create modern site pages.
Is there anye Site features that has to be enabled disabled to get the modern site pages?
Or is there another explanation to this?
Thanks
I had the same problem. I had to activate the SitePage feature in the site settings (see attached pic)
14 Replies
- Rajashekhar SheelvantBrass Contributor
Hi
Below powershell script worked for me.. I got it from microsoft technical team.
# Load SharePoint Online Client Components SDK Module
Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll'# Set script constants
$sitePagesFeatureIdString = 'B6917CB1-93A0-4B97-A84D-7CF49975D4EC'# Set up client context
$userName = Read-Host "Username"
$password = Read-Host "Password" -AsSecureString
$siteUrl = Read-Host "Site Url"
$webUrl = Read-Host "Server-Relative Web Url"
$context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)
$context.Credentials = $credentials# Get the list of existing features
$web = $context.Site.OpenWeb($webUrl)
$features = $web.Features
$context.Load($features)
$context.ExecuteQuery()# Verify that the Site Pages feature is not present in the web
if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0)
{
Write-Host "The Site Pages feature is already enabled in this web"
return
}# Add the Site Pages feature back to the web
$features.Add((new-object 'System.Guid' $sitePagesFeatureIdString), $false, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
$context.ExecuteQuery()# Verify that the Site Pages feature is now present in the web
$web = $context.Site.OpenWeb($webUrl)
$features = $web.Features
$context.Load($features)
$context.ExecuteQuery()if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0)
{
Write-Host "The Site Pages feature has been successfully enabled"
}
else
{
throw "The Site Pages feature failed to be enabled"
}- Pieter Op De BeéckIron Contributor
Hi, from a functional perspective, what exactly does this script do? Does it enable a certain feature or does it directly make a specific site collection as root site collection ... ?
Thanks for your feedback!
- Rajashekhar SheelvantBrass Contributor
This script enables the feature in the target site. With PNP powershell cmdlets we can achieve this just in few lines. Please refer to the script using pnp cmdlets below.
# Connect to a site
$cred = Get-Credential
Connect-PnPOnline -Url <Site URL> -Credentials $cred# Enable site pages feature at web
Enable-PnPFeature -Identity B6917CB1-93A0-4B97-A84D-7CF49975D4EC -Scope Web
- Jérôme LeloupCopper Contributor
- Levi JohnsonBrass Contributor
I also just discovered that if you enable SharePoint Server Publishing in Site Features, you cannot create the new modern pages in your site. If you disable it, it works right away.
- Katie FarnhamCopper ContributorI will check this out. Thank you.
- If modern experience is the default one in the tenant (you can check this on the SPO tenant settings), you don't need to enable at a site collection level...but bear in mind that if you have any customizations in your site collections, it could happen that the new stuff is not exposed to you...in those site collections: do you see the classic UI or the new one for Document Libraries?
- Odd Arne NohrCopper Contributor
In all the site-collection I have the modern layout on list and libraries.
I use the gear in top right corner and choose Add new page, on some sites it opens a modern page but for some it only give me option to set page name.
- Do you have any customizations applied to those sites where you are trying to create a modern page? Any feature you have enabled there? Which templates are the sites based on?