Thursday, July 30, 2020

Remove Page Header in SharePoint online Pages

In this post we will discuss about how to remove the Page header from the SharePoint online pages.


Typically, most of us faced issues when we create new pages in the SharePoint online, there will be header with the title of the page will be shown as like below. Give the page name (Name your page section) and publish the page. I have given the page name as TestPage.




From SharePoint UI there is no way to hide the header at least till this article published, so to hide the Page Header we will use PowerShell commands to hide the content.

There are 2 ways we can achieve the hiding page header.

1) Page level - In this case we will focus only on hiding the page header for the specific page.
2) Site Level - In this approach we are disabling the Page header at the site level.

Now we will see how we can disable for specific page.

1) Open SharePoint management shell (Run as admin)
2) Run the below scripts to disable Page header


#Declare variables sunch as Page name, Site URL
$SiteUrl = "https://bangten.sharepoint.com"
$PageTitle = "TestPage"

#UseWebLogin Uses Default Browser Authentication incase 
#if we have not connected we can remove that
Connect-PnPOnline -Url $SiteUrl -UseWebLogin

#Here we are setting the Layout type to Home its kind of landing page
Set-PnPClientSidePage -Identity $PageTitle -LayoutType Home

#Later at any point of time if we want Page Header back then use the below script
#Set-PnPClientSidePage -Identity $PageTitle -LayoutType Article



















Note: The above script can be run from Windows Powershell ISE as well also I have provided script for revert it back to old variant.

Now we will see how we can disable at site level

1) Open sharepoint management shell(Run as Admin)
2) Run the below scripts to remove the page header 


#Declare variables sunch as Page name, Site URL
$SiteUrl = "https://bangten.sharepoint.com"

Connect-PnPOnline -Url $SiteUrl -UseWebLogin
$PageCollection = (Get-PnPListItem -List SitePages).FieldValues

#Here we will loop through site pages collection and set the layout
foreach($Page in $pageCollection){
    Set-PnPClientSidePage -Identity $Page.FileLeafRef -LayoutType Home

    #Using below line we can revert the changes
    #Set-PnPClientSidePage -Identity $Page.FileLeafRef -LayoutType Article
}


From above steps we came to how we can handle Page Header in the SharePoint Modern Pages.

Wednesday, July 29, 2020

SharePoint Hub Sites Overview

This is my first blog in SharePoint Online topic, Let's start with Hub Site which is major architecture change in terms of modern SharePoint site vs classic SharePoint sites.


 
Let’s start understanding the Hub site by going through its features

  • Hierarchical structure
This is one of the basic features of hub site, we will focus more on this section.
We do not have the concept of Sub sites in modern SharePoint anymore. In Classic SharePoint we have site collections and each site collections have several sub sites under it. All the site collections are maintained in a hierarchical structure. When customization grew more complicated and the user requirements became more agile, deleting sub sites and restructuring them is also more difficult.

Another main disadvantage is external sharing, external sharing is not possible to only one specific sub site, we need to enable external sharing for entire site collection. So, this will hamper the site security and maintenance.

As a gist, the hierarchical structure of site collections and their sub sites were not robust to the modern requirements.This problem can be overcome by using hub architecture where there is no concept hierarchical structure, it will be flat architecture. There are no sub sites. In modern SharePoint, every single site is a site collection. If we have any such requirement for hierarchical structure, then we can use hub site concept to achieve the same.

It is easily maintainable and restructure and external sharing can be done to any independent site collections present or associated to a hub site. So, the security and maintenance is like a piece of cake in this type of flat art hierarchy

  • Look and Feel
All Sub sites inherits their look and feel from the root (Hub site) which allows you to maintain a single branding across all your sites. In a simple term, all sites are associated, which means they resides under one Hub

  • Common/Shared Top Navigation (Global Navigation)
A common global navigation is maintained across all connected sites of the Hub site.
If we want to create custom navigation or we can call it as site specific navigation, we can still go ahead and create it

  • Scoped Enterprise Search
This is one of the very good feature of hub site. If we search for any content in the site it performs the search within all the sites of that Hub Site.

  • Content Aggregation
Automatically aggregates content and displaying from multiple sites. News Web Part, Sites Web Part and Content Web Part can be used in a Hub Site to aggregate content from the associated sites and display the content on the Hub Site’s home page. This reduces a lot of manual work that developers supposed to do to get this done in the earlier days.

Who can create SharePoint Hub Site?
SharePoint Administrator will be able to create SharePoint hub sites, however site owners can associate a SharePoint site with the hub site.


How we can create the hub sites?

For demo purpose I have created one communication (TestCommunication) and 2 team sites (TestHub, FinanceHub)

Let's start with opening Office 365 portal.



Now we will associate FinanceHub and TeamHub site to TestCommunication site.

Open TestCommunication site and go to the site settings and under the site information. We have an option called Hub Site Association. Right now, it is not associated to any hub site as below




The TestCommunication website which we created, was not a hub site yet. Until we do one final setting this we cannot use as hub site.


Now open SharePoint admin site, this opens SharePoint Admin Center (if this opens in classic mode, then open it in modern view)


Here we are performing the following steps:


1) Open SharePoint Admin Site (Change the site from classic mode to modern site)

2) Click on Active Sites, which will show the all the sites which we created in earlier section.





Now its time to make the site as Hub.


1) Select TestCommunication site and click Hub from the menu.

2) Select Register Site as Hub site

3) Give name of the Hub site and give the site owner name/give everyone access based on the business requirement. Careful while giving everyone permission.




In next step we will associate TeamHub site and Finance Hub site to Test Comminication hub site.


Select TeamHub site and associate the site to hub site which we created in the previous steps.




Repeat the same steps for the Finance Hub site.



From the above steps we have associated all the newly created site as hub sites under Parent site


Note:


This is one way of associating the newly created site as hub site in SharePoint admin site. But we can do from the site as well. Open the teamhub site. By using site information option. And from here you can select TestCommunication hub site. Save. Once this option is. Saved you can see the HR hub site appearing over here.



In this post we created hub site and associated the sites to the hub sites. In the next blog we know more details about the how we can provide the same look and feel, how we can move the sites, detach the hub site.

More details about how we can create the Hub site hierarchy in PowerShell

Note:

The steps shown in the image was taken on 28th July 2020, and there might be chances some UI changes in the future.