Let's explore a simple way to create a modern communication site and register it as a hub. Once registered let's add a logo image along with a footer. Let's use a comm site as it has footer enabled. We'll customize it further using the below PnP & SP Online PowerShell program rather than using the Modern Team site for this approach.
Open the SharePoint Online Management Shell.
Run the below commands after fine tuning the details for your usage.
- $Tenantadminurl = "https://<TenantName>-admin.sharepoint.com/"
- Connect-PnPOnline $Tenantadminurl -useweblogin
- # Create the new "modern" communication site with SiteDesign Topic/Showcase/Blank
- $communicationSiteUrl = New-PnPSite -Type CommunicationSite -Title "TestHubE" -Url "https://bunnomatic1.sharepoint.com/sites/TestHubE" -Description "TestHubE" -Classification "HubE" -SiteDesign Blank
- # Connect to the modern site using PnP PowerShell SP cmdlets
- # Since we are connecting now to SP side, credentials will be asked
- Connect-PnPOnline $communicationSiteUrl -useweblogin
- # Now we have access on the SharePoint site for any operations
- $context = Get-PnPContext
- $web = Get-PnPWeb
- #$context.Load($web, $web.Title)
- #Execute-PnPQuery
- $web.Title
- Connect-pnponline -url $communicationSiteUrl -useweblogin
- Apply-PnPProvisioningTemplate -Path D:\SiteFooter1.xml
- #Using SPOService Connection
- $cred = [System.Net.CredentialCache]::DefaultCredentials
- [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred
- #If you want to turn it as a Hub site
- Connect-SPOService -Url $Tenantadminurl
- #Register-PnPHubSite -Site $communicationSiteUrl
- Register-SPOHubSite $communicationSiteUrl -Principals $null
- $Hubsite=$communicationSiteUrl
- Set-SPOHubSite $Hubsite `
- -Title "Hub E" `
- -LogoUrl https:
- -Description "Hub for the 'E' division”
- #Please provide the Logo url exactly the location where your Logo is available and don't ommit that ` symbol.
- Get-SPOHubSite -Identity $Hubsite
The above code also has SiteFooter.xml which has the below code in it and can be tuned/added/edited with more changes as per your footer customizations.
- <?xml version="1.0"?>
- <pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/03/ProvisioningSchema">
- <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.10.1906.0, Culture=neutral, PublicKeyToken=null" />
- <pnp:Templates ID="CONTAINER-TEMPLATE-349B964A1A644BA3A310BFA16668495E">
- <pnp:ProvisioningTemplate ID="TEMPLATE-349B964A1A644BA3A310BFA16668495E" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite">
- <pnp:Footer Enabled="true" RemoveExistingNodes="true">
- <pnp:FooterLinks>
- <pnp:FooterLink DisplayName="Contact Us" Url="mailto:[email protected]" />
-
- <pnp:FooterLink DisplayName="IT Support" Url="http://ClientName.zendesk.com" />
- <pnp:FooterLink DisplayName="Help" Url="https://<TenantName>.sharepoint.com/sites/Client/SitePages/Client-Hubs-Help-Page.aspx" />
-
- </pnp:FooterLinks>
- </pnp:Footer>
- </pnp:ProvisioningTemplate>
- </pnp:Templates>
- </pnp:Provisioning>
The above site footer code has 3 footer links and needs to be added in the reverse order to show its effect from left to right on your site collection page.