Requirement: Set Home Page in SharePoint Online.
How to Change the Default Home page in SharePoint Online?
The welcome page or Home page is the default page displayed when you browse to the site. By default, the Home.aspx page in the Site Pages library is defined as the site’s welcome page. You can create a new page and set it as a welcome page. To set the home page in SharePoint Online, do the following:
- Navigate to Site Settings >> Click on the “Welcome Page” link under the “Look and Feel” group.
- This takes you to the “Site Welcome Page” (/_layouts/15/AreaWelcomePage.aspx) where you can pick any existing page and set it as a welcome page or home page for your SharePoint Online site.
This changes the welcome page in SharePoint Online.
SharePoint Online: Set Modern Page as Homepage
How to make a custom page as a homepage in SharePoint Online? In modern sites, You can change the site home page by navigating to:
- Click on “Site Settings” gear icon >> Choose “Site Contents”.
- Click on “Site Pages” Library >> Right click on the target Home page, and select “Make Home Page” from the context menu.
This sets the page as the home page in SharePoint Online! The same procedure applies to the modern team site or communication site collections.
SharePoint Online: Change home page using PowerShell
Here is the PowerShell to set the page as a homepage in SharePoint Online:
#Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Parameter Values $SiteURL="https://crescent.sharepoint.com" #Relative url of the homepage $HomePageURL="SitePages/default.aspx" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Cred #sharepoint online powershell set home page $Ctx.web.RootFolder.WelcomePage = $HomePageURL $Ctx.web.RootFolder.Update() $Ctx.ExecuteQuery()
This PowerShell CSOM script sets the home page in SharePoint Online.
Make Document Library as home page in SharePoint Online
How to make a document library as the homepage in SharePoint Online? You can create a new page, add the document library web part to it, pick the relevant document library and then set that page as the home page by going to Site contents >> Site Pages >> Select the Page and click on “Make homepage” from the toolbar.
How about setting a document library as the start page on “Classic Experience”? Sure, follow these steps:
- Navigate to the document library >> Click the Settings gear >> > Edit page.
- Click on the Page tab in the ribbon from the top of the page and select “Make Homepage”, and confirm the prompt.
- Click on “Stop Editing” to commit your changes.
Now you should see the particular document library is set as the site homepage. You can also create a new wiki page and use the above method.
PnP PowerShell to Make Document Library as home page in SharePoint Online
This time, let’s set a document library as a home page for a SharePoint Online site using PnP PowerShell.
#Config Variables $SiteURL = "https://Crescent.sharepoint.com/Sales" #Page Relative URL to the Web $HomePageURL = "Shared Documents/Forms/AllItems.aspx" #Get Credentials to connect $Cred = Get-Credential #Connect to PnP Online Connect-PnPOnline -Url $SiteURL -Credentials $Cred #make a document library as home page in sharepoint online Set-PnPHomePage -RootFolderRelativeUrl $HomePageURL
Similarly, You can set a List page as Home page by setting the $HomePageURL parameter to: $HomePageURL = “Lists/PortfolioTracker/AllItems.aspx”.
Set-PnPHomePage -RootFolderRelativeUrl Shared%20Documents/Forms/AllItems.aspx
How to Recreate a Home Page in SharePoint Online?
The existing home page is deleted, and you are getting a “404 Error” in SharePoint Online? If it can’t be restored from the recycle bin, Here is how to create a new home page on a SharePoint site:
- Navigate to the “Site Contents” page with the URL shortcut: /_layouts/15/viewlsts.aspx (e.g., https://YourDomain.sharepoint.com/sites/YourSite/_layouts/15/viewlsts.aspx)
- Click on “Site Pages” in the Site Contents
- Create a new site page by clicking on “New” >> “Site Page”.
- Enter the name for your modern SharePoint page and add the necessary content to it, and then publish.
- Once published, Right-click on the newly created page and select “Make homepage”.
If you are looking for setting up the Home site for your SharePoint Online tenant, refer: How to Set the Home Site in SharePoint Online?