I've been tasked with creating a footer that is the same across multiple sites in our O365 SharePoint. I'm comfortable putting this code into a site's masterpage, but I would like to have the HTML stored in one location so that I can update it in one place rather than copy/pasting HTML across multiple sites.

Any recommendations?


You should be able to insert your HTML code in a copy of the default master page you are already using, download it locally and and then publish it and set it as masterpage for your sites using O365 dev PnP Powershell cmdlts.

As i'm not using O365 myself i haven't been able to try it out but should be doable.

OfficeDevPnP.PowerShell Commands

There are some prerequisites to be able to use the commands but after that you should be able to do something like this:

Connect-SPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)

$sites = Get-SPOSite

foreach ($site in $sites)
Add-SPOMasterPage -SourceFilePath "page.master" -Title "MasterPage" -Description "MasterPage for Web" -DestinationFolderHierarchy "SubFolder"

Set-SPOMasterPage -MasterPageServerRelativeUrl /sites/projects/_catalogs/masterpage/oslo.master

Add masterpage: https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/AddSPOMasterPage.md

Set masterpage: https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/SetSPOMasterPage.md

Be aware that i have not tested this out myself so no guarantees. It might be a good start if anything.

Deploying Artifacts to Office 365 using PowerShell

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.