Create SharePoint Online Modern Page + PnP PowerShell

In this SharePoint tutorial, let us discuss how to create SharePoint Online modern page. We will also see how to enable or disable modern page creation in Office 365 SharePoint Online.

In detail, we will discuss here:

  • What are modern pages in SharePoint Online or SharePoint 2019?
  • Enable or Disable modern SharePoint page creation in Office 365
  • How to create SharePoint Online modern page?
  • SharePoint Online modern page templates
  • How to customize and publish SharePoint modern page?
  • SharePoint Online modern page comments
  • How to disable comments in modern SharePoint pages?
  • How to prevent users from creating modern pages in a SharePoint Online site using PowerShell?
  • Create modern page SharePoint Online PowerShell
  • SharePoint modern page header image size
  • SharePoint Online modern page remove header

SharePoint Online modern pages

  • Microsoft released modern experience in the year 2016 and this is one of the most useful features that Microsoft released in the SharePoint Online modern experience. As an organization, we can use SharePoint Online modern pages to share ideas with other users by using images, format text, excel, PowerPoint, videos, reports, etc.
  • Creating a modern SharePoint page is easy and faster compared to the classic way of creating pages in SharePoint Online.
  • The pages are responsive and look great on all the devices like laptops, tablets,s or mobile devices.
  • To share information, just create a page, customize pages using various web parts and then publish the page.

Note:

  • This feature is available in SharePoint Online and SharePoint server 2019.
  • You need to be a SharePoint site owner or a SharePoint administrator to add new pages.
  • You can create modern pages in the SharePoint site pages library only.
  • Once the modern page got created, you can not change the URL of the page.

Enable or Disable modern SharePoint page creation in Office 365

As an organization, you can enable to disable modern SharePoint page creation in Office 365 or SharePoint Online. Let us see, how to enable or disable SharePoint modern page creation at the tenant level.

Open the SharePoint Online admin center.

https://<tenant name>-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/home

https://tsinfo-admin.sharepoint.com/_layouts/15/online/AdminHome.aspx#/home

Then click on Settings. From the Settings page, click on Pages.

sharepoint online modern page
sharepoint online modern page

Then in the Pages, you can see two options:

  • Allow users to create new modern pages
  • Allow commenting on modern pages

To enable page creation, select the “Allow users to create new modern pages” option and deselect to disable the option.

Enable modern SharePoint page creation in Office 365
Enable modern SharePoint page creation in Office 365

This is how we can enable or disable SharePoint Online modern page creation in Office 365.

Create a modern page in SharePoint Online Site

Now, let us see how to create a modern page in SharePoint Online site.

From the SharePoint site home page, click on + New -> Page.

create sharepoint online modern page
create sharepoint online modern page

SharePoint Online modern page templates

In the next step,

It will ask you to select a SharePoint online modern page template. By default, SharePoint provides three templates like below:

  • Blank: Choose this template if you want to build something from the scratch. Nothing will be there, you can add columns, text, images, videos, etc.
  • Visual: When you select the Visual template, you will get a visually attractive page which will have images, text, and links, etc.
  • Basic text: The basic text SharePoint online modern page templates consist of two columns and also it will have proper text formatting.

Choose one according to the requirement.

Create modern page in SharePoint Online Site
Create modern page in SharePoint Online Site

Then click on Create page button. Then it will ask you to provide a Name for the Page.

Remember, whatever name you will provide the first time, it will take the URL also. For example, here I have given the Title as Training Information, then the URL will become as Training-Information.

how to create a modern page in sharepoint
how to create a modern page in sharepoint

Once you customize the page you can click on the Publish button which presented in the top right corner of the page. Once you click on the Publish, the page will be available to the users.

how to create a modern page in sharepoint online
how to create a modern page in sharepoint online

When you first time publish a page, it will show a few more information like:

  • Add page to navigation
  • Post as News on this site
  • Email
  • Save as page template

And also you can see the Page address.

how to create a modern page in sharepoint 2019
how to create a modern page in sharepoint 2019

The page will be created and stored in the Site Pages document library. You can see below:

create a modern page in sharepoint 2019
create a modern page in sharepoint 2019

This is how we can create a modern page in SharePoint Online.

Customize SharePoint online modern page

Now, let us see how we can customize SharePoint Online modern page according to your business requirement.

Microsoft provides various out of box web parts that we can use to display information on the modern page. A few examples are:

Just a note, we can not add classic web parts to a modern SharePoint page.

To add a web part into an already published page, first click on the Edit icon.

Customize SharePoint online modern page
Customize SharePoint online modern page

Then the page will open in the edit mode.

The best approach to modify the page and add information is to add a section. Just hover on the left side of the page, you can see a + icon to add sections to the page.

There are various section layouts are there to choose from like:

  • One column
  • Two columns
  • Three columns
  • One-third left column
  • One-third right column
  • Vertical section.
customize sharepoint online mdoern page
customize sharepoint online mdoern page

You can choose any section according to your requirement. Here you can see I have added two columns section layout, the page looks like below:

Here click on the + icon and you can see various SharePoint modern web parts you can add into your page.

How to customize sharepoint online modern page
How to customize sharepoint online modern page

Lets us a few example of SharePoint Online modern site customizations.

Overlap Page Title

To edit the SharePoint Online modern page title, edit the page and click on the Edit web part icon that is presented in the Title area.

edit page title in sharepoint online
edit page title in sharepoint online

This will open the Title area properties panel and you can change from various options like:

  • Layout: You can choose from various layouts like Image and title, Plain, Color bock, and Overlap.
  • Alignment: Choose from Left or Center alignment.
  • Text above title: Add a 40 characters limit text above the page title.
Overlap SharePoint modern Page Title
Overlap SharePoint modern Page Title

Now, when you Republish the page, you can see an Overlap title of your SharePoint Online modern page.

How to edit SharePoint Online modern page title
How to edit SharePoint Online modern page title

SharePoint modern pages remove banner

In another customization example, let us see how to remove banner in SharePoint Online modern pages.

Edit the header area and then from the properties, choose the Layout as Plain.

sharepoint modern pages remove banner
sharepoint modern pages remove banner

Now, you can see the image or banner is not there in the SharePoint Online modern page.

sharepoint online modern page remove header
sharepoint online modern page remove header

This is how to remove banner in SharePoint modern page.

SharePoint Online modern page comments

By default, on SharePoint Online modern page, you can give comments, likes and also you can see the Views and you will have also the option to save for later.

A user can go to the comments section and provide comments on the page. Also, while providing comments, users can mention other people. Here is another example.

sharepoint online modern page disable comments

You can also click on the Like button to like the page, and you can see the number of views and number of comments.

Disable comments on SharePoint Online modern page

Let us check out now how to disable comments on SharePoint Online modern page. As an organization, sometimes you might not need to allow comments on SharePoint Online modern pages, in those scenarios you can disable the modern page comments in SharePoint Online.

By default comments are enabled in SharePoint Online modern pages, but we can easily disable comments in the modern pages.

Note: You need to have at least contribute or edit permission to enable or disable comments on the modern SharePoint Online pages.

Microsoft allows us to disable comments at the page level as well as at the tenant level. Now, we will see:

  • How to disable comments at the page level on SharePoint Online modern page
  • How to disable comments at the tenant level in SharePoint

Disable comments at the modern SharePoint Online page level

Now, let us see how to disable comments for a particular modern page. Edit the SharePoint Online modern page and then scroll down you will see the toggle button to On/Off comments on the modern page. There make the comments Off like below:

disable comments sharepoint online modern page
disable comments sharepoint online modern page

Note: Even if you disable the comments, the comments will not be deleted, the comments will still be available and will appear when you enable the comment on the modern page in SharePoint Online.

Disable comments for SharePoint Online modern pages globally

Now, let us see how to disable comments globally in SharePoint Online, so that the comments will be OFF for all the pages in SharePoint Online.

Open the SharePoint Online admin center and then click on Settings -> Pages and then unselect, Allow commenting on modern pages.

disable comments in sharepoint online modern page
disable comments in sharepoint online modern page

Now the comments will be disabled in all the modern SharePoint Online pages. Users will not be able to add comments on modern SharePoint pages. It might take ~20 minutes to disable comments on the SharePoint Online tenant.

Note: Even if you disable the comment at globally, the comments will still be there and when you enable the commenting in modern pages, the comments will appear.

This is how we can disable comments in SharePoint Online modern pages individually or globally for all the pages.

SharePoint modern page header image size

What is the SharePoint modern page header image size? In the header or in the page title area the image looks great when they are in landscape mode or greater in aspect ratio. And also it should be at least 1 MB size. And also, you should keep the focal point in the important part of the picture in the view.

SharePoint Online modern page remove header

If you look at a modern SharePoint Online page, you will see the header and the image take lot of space of the page. It looks like below:

sharepoint online modern page remove header
sharepoint online modern page remove header

You might not require the header banner on the page always. By using SharePoint Online management shell or PowerShell, we can remove the header from the SharePoint Online modern page.

Connect-PnPOnline https://tsinfotechnologies.sharepoint.com/sites/SPGuides/ -UseWebLogin

Set-PnPListItem -List SitePages –Identity 2 -Values @{"PageLayoutType"="Home"}  

Here 2 is the item ID or the page ID, just add the id column in the All items view and you can see the item id.

sharepoint modern page header

Once you run the PowerShell cmdlets, and then refresh the page, the SharePoint Online modern page header has been removed. You can see below:

how to remove header in sharepoint online modern page
how to remove header in sharepoint online modern page

If you want to bring back the SharePoint Online modern page header, then run the below command.

Connect-PnPOnline https://tsinfotechnologies.sharepoint.com/sites/SPGuides/ -UseWebLogin
  
Set-PnPListItem -List SitePages –Identity 2 -Values @{"PageLayoutType"="Article"}  

Here through this PowerShell cmdlet, we are changing the page layouts to Home from Article. By default, the SharePoint Online modern page will have the page layout as Article that will have the header banner. So we are changing the page layouts to Home.

I hope now, you got an idea how to remove the SharePoint Online modern page header.

Prevent users from creating modern pages in a SharePoint Online site using PowerShell

If you want to prevent users from creating modern pages in the SharePoint Online site using PowerShell, then follow this MSDN article.

Create modern page SharePoint Online PowerShell

Now, let us see how to create a modern page in SharePoint Online using PowerShell. Below is the PnP PowerShell script that will create a modern SharePoint Online page.

Connect-PnPOnline -Url https://tsinfotechnologies.sharepoint.com/sites/SPGuides/ -UseWebLogin

$newPage = Add-PnPClientSidePage -Name "Training" -LayoutType Article

$newPage.Publish()

You can run the script in Windows PowerShell ISE and then you can open the Site Pages library and you can see the page got created.

Create modern page SharePoint Online PowerShell
Create modern page SharePoint Online PowerShell

This is how we can create a modern page using pnp PowerShell in SharePoint Online.

You may like the following SharePoint tutorials:

In this SharePoint tutorial, we learned about the SharePoint Online modern pages and covers the below topics.

  • What are SharePoint Online modern pages?
  • How to Enable or Disable modern SharePoint page creation in Office 365
  • How to Create a modern page in SharePoint Online Site
  • SharePoint Online modern page templates
  • How to Customize SharePoint online modern page
  • SharePoint Online modern page comments
  • How to disable comments on SharePoint Online modern page
  • How to disable comments at the modern SharePoint Online page level
  • How to disable comments for SharePoint Online modern pages globally
  • SharePoint modern page header image size
  • SharePoint Online modern page remove header
  • Create modern page SharePoint Online PowerShell
>