Answered by:
Branding SharePoint - MasterPages and CSS Fails to Apply on Subsites

Question
-
Hi all,
I have a SharePoint 2010 site. I have customised the v4.master masterpage and the changes I made there and the corev4.css are working on the main site, but it does not apply to the other subsite.
Please how do I get a consistent look and feel on all my subsites.
Thanks.
Ifeatu OsegboWednesday, August 3, 2011 11:10 AM
Answers
-
Each SharePoint site has its own master page setting. If you edited the master page and CSS using SharePoint Designer then those changes were only made to files in the top level site. If the Publishing feature is turned on then you can use the Master Page Link under Look and Feel in the Site Actions > Site Settings page to apply the master page stored in the top level site to all the child sites. But the changes you made to the coreV4.css file are still stored locally and there is no easy way to apply those to all the sub sites.
If publishing isn't turned on then the only way to change the master page in all the sites is programmatically. This would also be how you would override the existing CSS files.
BTW, Its really not a good idea to edit the existing files supplied by Microsoft. You should make a copy of the master page and edit that. For the CSS you should create your own CSS File that overrides the settings in the corev4.css file.
Paul Stork SharePoint Server MVP- Proposed as answer by KSDN Thursday, August 4, 2011 12:24 PM
- Marked as answer by Ifeatu Osegbo Sunday, August 7, 2011 10:50 AM
Wednesday, August 3, 2011 11:49 AM -
Hi Ifeatu,
to inherit all subsites from the main site. Just open the Site Settings of your branded site and go to "Look and Feel - Master page".
There you can "Reset" all subsites to your branded master page.
Direct Link: http://myserver/_Layouts/ChangeSiteMasterPage.aspx
You can also do this via Powershell - try this:
$site = Get-SPSite "http://mySiteCollection"
foreach ($web in $site.AllWebs) {
$web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"
$web.Update()
}Cheers
Christian Handler, MCITP SharePoint 2010 Administration, Plug 'n Play Branding for SharePoint 2010, http://www.nextflow.at
- Edited by Handler Christian, MCITP Thursday, August 4, 2011 9:51 AM
- Marked as answer by Ifeatu Osegbo Sunday, August 7, 2011 10:50 AM
- Edited by Clayton Cobb Wednesday, September 7, 2011 5:33 AM Removed blatant advertising
Wednesday, August 3, 2011 2:33 PM
All replies
-
Each SharePoint site has its own master page setting. If you edited the master page and CSS using SharePoint Designer then those changes were only made to files in the top level site. If the Publishing feature is turned on then you can use the Master Page Link under Look and Feel in the Site Actions > Site Settings page to apply the master page stored in the top level site to all the child sites. But the changes you made to the coreV4.css file are still stored locally and there is no easy way to apply those to all the sub sites.
If publishing isn't turned on then the only way to change the master page in all the sites is programmatically. This would also be how you would override the existing CSS files.
BTW, Its really not a good idea to edit the existing files supplied by Microsoft. You should make a copy of the master page and edit that. For the CSS you should create your own CSS File that overrides the settings in the corev4.css file.
Paul Stork SharePoint Server MVP- Proposed as answer by KSDN Thursday, August 4, 2011 12:24 PM
- Marked as answer by Ifeatu Osegbo Sunday, August 7, 2011 10:50 AM
Wednesday, August 3, 2011 11:49 AM -
Each SharePoint site has its own master page setting. If you edited the master page and CSS using SharePoint Designer then those changes were only made to files in the top level site. If the Publishing feature is turned on then you can use the Master Page Link under Look and Feel in the Site Actions > Site Settings page to apply the master page stored in the top level site to all the child sites. But the changes you made to the coreV4.css file are still stored locally and there is no easy way to apply those to all the sub sites.
Thanks Paul,
Please how to I go about making this change. How can I set the Master Page and CSS file to apply across. Also, I made a customised copy of the V4.master, so am not really editing stuffs from MSFT.
Thanks.
Ifeatu OsegboWednesday, August 3, 2011 1:28 PM -
Hi Ifeatu,
to inherit all subsites from the main site. Just open the Site Settings of your branded site and go to "Look and Feel - Master page".
There you can "Reset" all subsites to your branded master page.
Direct Link: http://myserver/_Layouts/ChangeSiteMasterPage.aspx
You can also do this via Powershell - try this:
$site = Get-SPSite "http://mySiteCollection"
foreach ($web in $site.AllWebs) {
$web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"
$web.Update()
}Cheers
Christian Handler, MCITP SharePoint 2010 Administration, Plug 'n Play Branding for SharePoint 2010, http://www.nextflow.at
- Edited by Handler Christian, MCITP Thursday, August 4, 2011 9:51 AM
- Marked as answer by Ifeatu Osegbo Sunday, August 7, 2011 10:50 AM
- Edited by Clayton Cobb Wednesday, September 7, 2011 5:33 AM Removed blatant advertising
Wednesday, August 3, 2011 2:33 PM -
There you can "Reset" all subsites to your branded master page.
Direct Link: http://myserver/_Layouts/ChangeSiteMasterPage.aspx
You can also do this via Powershell - try this:
foreach ($site in get-spsite -url http://myServerURL*) {
$web = Get-SPWeb $site
$web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"
$web.Update()
}Hello Christian,
Thanks indeed....I am sure the option of reseting subsites to inherit master pages was available on 2007....am yet to see it in 2010.
Is it possible to run the same on Powershell script SharePoint 2010?
Thanks
Ifeatu OsegboWednesday, August 3, 2011 5:42 PM -
Hi Ifeatu,
there was a small mistake in the old PS script. This one is working for SharePoint 2010.
It sets all subsites within one SiteCollection to the custom.master.
$site = Get-SPSite "http://mySiteCollection"
foreach ($web in $site.AllWebs) {
$web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"
$web.Update()
}
Christian Handler, MCITP SharePoint 2010 Administration, Plug 'n Play Branding for SharePoint 2010, http://www.nextflow.at- Edited by Clayton Cobb Wednesday, September 7, 2011 5:32 AM Removed blatant advertising
Thursday, August 4, 2011 9:53 AM -
Just to clarify one point from above. Setting the customMasterUrl for the sub sites will only effect pages stored in the Pages document library. If you haven't turned on Publishing it willhave no effect. There are two settings on each Web that dictate the master page used by a page. Publishing pages by default use the CustomMasterUrl and other pages use the MasterUrl setting. So to change the master page for all pages in all subsites you would need the following powershell:
$site = Get-SPSite "http://mySiteCollection"
foreach ($web in $site.AllWebs) {
$web.CustomMasterUrl = "/_catalogs/masterpage/nameofcustommaster"
$web.MasterUrl = "/_catalogs/masterpage/nameofcustommaster"
$web.Update()
}
Paul Stork SharePoint Server MVPThursday, August 4, 2011 11:37 AM -
Just to add to this discussion -- I normally follow something similar to what is described in this whitepaper when deploying branding. That takes care of things right from the beginning:
http://msdn.microsoft.com/en-us/library/gg447066.aspx
John Ross
SharePoint Server MVP | Sr. Consultant SharePoint911: SharePoint Consulting
Blog: http://www.sharepoint911.com/blogs/john
Twitter: @JohnRossJr
Professional SharePoint 2010 Branding and User Interface Design (Wrox Programmer to Programmer)Thursday, August 4, 2011 12:44 PM -
OK,
Thanks all. The PowerShell scripts executes well but the changes I made to the customised Corev4.css does not reflect on the subsite.
Also, I try to edit the CSS on the new subsite and it does not work.
Please help
Ifeatu OsegboSunday, August 7, 2011 4:06 AM -
Thanks All,
I found my errors here: http://www.sharepointedutech.com/2011/06/28/apply-master-page-for-all-subsites-in-sharepoint-2010/
I did not Activate SharePoint Publishing Infrastructure at Site Settings > Site Actions > SharePoint Publishing infrastructure.
I also had to activate this on all the sites I created for it to work.
Thanks.
Ifeatu OsegboSunday, August 7, 2011 10:50 AM -
The powershell script just points the sub sites at the new master page. It doesn't do anything for the custom css. To use that on the subsites you need to make sure you deploy a custom.css and reference it in the custom master page. The edits you made to the css only customize it for the local site. The master page still references the original for all the sub sites.
Paul Stork SharePoint Server MVP Chief SharePoint Architect: Sharesquared Blog: http://dontpapanic.com/blog Twitter: @pstorkSunday, August 7, 2011 11:57 AM -
Hi all, in addition to what Paul says, you can use following PS to update sites with the publishing functinality as well as sites that dont have this feature enabled. This is for the two types CustomMaster and Master:
$site = Get-SPSite http://MySiteCollection
foreach ($web in $site.AllWebs) {
$web; $web.CustomMasterUrl = "/_catalogs/masterpage/nameofcustommaster.master";
$web.Update(); $web.CustomMasterUrl;
$web.Dispose()
}
foreach ($web in $site.AllWebs) {
$web; $web.MasterUrl = "/_catalogs/masterpage/nameofcustommaster.master";
$web.Update(); $web.MasterUrl;
$web.Dispose()
}
$site.Dispose()And as John D. Ross says, this thing can be fixed by a branding solution with VS (farm or sandbox) so all new sites like team sites inherit the custom master in the moment they creates.
/ C
Blog: chrisstahl.wordpress.com Twitter: @Cstahl
- Edited by Christian Stal Monday, October 24, 2011 9:05 AM
Monday, October 24, 2011 9:02 AM -
Hi,
Can i ask simply mistaken question that have you published your master page at root level.I was also came across similar kind of situation and finally i found that my master page was not published so whenever i was making any such changes and clicking on "Save", Changes were reflecting on main site but they were not on the other or child sub sites.So you also can try if this is the problem.all the best.
Regards,
Hirwani Jain
Friday, March 30, 2012 9:07 AM