With the rise of Office 365 and SharePoint online, the ancient practice of using a custom master page to brand a SharePoint site is coming to an end. SharePoint online has many incremental changes, bug fixes and improvements to the Seattle master page meaning that if you have taken a copy of this Master Page to apply your branding, you could be missing out on the constant evolution of SharePoint online.
Custom Master Pages can still be used but Microsoft recommend against this now. The good news is that we can make exactly the same branding changes without having to use a custom master page.
I will briefly mention that you can create themes for SharePoint very quickly using Microsoft’s free tool which can be downloaded from here. Great for quick colour palettes and background images but not great if you want a responsive or more custom design.
Custom master pages (for branding purposes) tended to have a small number of adjustments such as:
- Custom HTML (maybe for a menu container)
- Links to CSS files (for responsive styling and branding)
Link to custom CSS file
A link to a custom CSS file is recommended for advanced branding changes. This won’t affect any improvements to the default Seattle master page however you may need to update the CSS from time to time to reflect any interface changes. The alternative CSS link can be set via the GUI on a publishing site or by CSOM on any site.
#Run all of your lines to load the context of the site collection $context.Load($site) #add custom js injection action $customJSAction = $site.UsercustomJSActions.Add(); $customJSAction.Location = “ScriptLink”; #reference to JS file $customJSAction.ScriptSrc = “~SiteCollection/Style Library/JS Display Templates/test.js”; #load it last $customJSAction.Sequence = 1000; #make the changes $customJSAction.Update(); $context.ExecuteQuery();
You can use the same objects to remove all the custom actions and list them. You can find out more information and the C# examples here.
Although this is a different way of thinking about branding, in the long run, it’s cleaner and more reusable than custom master pages. Your customers will have a better experience in Office 365 but even CSS and DOM manipulation may need updating as SharePoint evolves.
Some really useful examples and more detailed explanations can be found on Vesa Juvonen’s Ignite talk. In Vesa’s example he uses Visual Studio and Apps to deploy the CSS and JS.