How can I apply a master page to a subsite without designer?
-
21-12-2020 - |
Question
I'd like to apply a custom master page to a subsite.
The intent is simply to attach the jQuery library and a loader script to the master page. I have full control to all subsites.
Strict limitations
- SP designer is blocked in my environment
- I only have read access to the site collection's master page gallery. I'm not a site collection admin.
- The publishing feature isn't active for the site collection, but is active for subsites, including my test site.
Steps Taken
I created a copy of seattle.master from the subsites Master Page Gallery. I added the 2 script lines, and uploaded it back to the subsite Master Page Gallery. (Renamed SeattleV2.aspx).
SeattleV2 isn't one of the drop-downs available on the
/_layouts/15/ChangeSiteMasterPage.aspx
page.I don't have the option to publish a master page; the publish option is greyed out on subsites.
(note: I'm Site Collection Admin of a different collection in the same environment and the publish option is disabled for subsites there as well. It's only active on the root master page gallery).
- Directly editing the subsites seattle.master doesn't work even when it set to inherit from it's parent site. It appears to still use a copy of the root Site's seattle.master, instead of the subsites.
La solution
If you want to load a couple of JS files
Then forget about injecting stuff in MasterPages and use User Custom Actions
(only been around since 2010):
And instead of Johns ASPX file,
use a Chrome Extension to just apply content to any SP site
https://github.com/tavikukko/Chrome-SP-Editor
iSPE
Autres conseils
You can't publish because you have to activate the Publishing Feature in site collection features. Follow these steps.
Go to Site Settings of root site. Then Go to Site Collection Features
Activate this Feature: SharePoint Server Publishing Infrastructure
Go to the Subsite -> Site Settings -> Site Features
Activate this feature: SharePoint Server Publishing
Then upload your edited master page to Master Page Gallery and use it.