Question

I know how to deploy the masterpages and styles like css, javascripts, images etc, my question is rather what is the best practice?

As I deploy the all the requisites on a site collection in the style libraries etc by the site collection scoped feature. Activating this feature will activate the styles on this site collection. So for each site collection in style libraries those files will be created.

But in masterpage I can also refer all my css registrations and images etc for a root site collection, this way only activating the feature on the root site collection will aslo affect the other site collections if the master page is applied, and I only will have those files on the root site collection style library.

I'm hesitating between this, of course only activating on the root site collection, will reduce the amount of files in the portal but still ... Of course by doing this I will have everywhere the same layout and styles for all the site collection but that is also the case what I want to achieve.

So should I deploy only on root site collection, or for every site collection differently?

Was it helpful?

Solution

Since you have packaged your branding elements including master page, css, images, js, etc into a feature (scoped to site), then I recommend that you activate this feature on each site collection (root site and sub site collections, i.e. yourdomain/sites/subsite1). The feature should include a module to transfer _catalogs/masterpage assets and at least another module to transfer Style Library assets. Since you are using a feature anyhow, any time you make an update the the branding, the feature should handle updating the assets and you can use powershell to force the upgrade to all site collection.

Yes, this means that each site collection will include all branding elements, but each site collection needs to at least include the masterpage assets anyhow. For the Style Library you could always place those elements in the 14 hive (_layouts). In your case that would be the best location for them.

If you wanted to have only one copy of Style Library assets, just at the root site collection, then you would most likely need to have two features, one that installs the master page and another that installs the style library assets. Activate the master page feature on all site collections, but the style library one only on the root site collection. Then set the master page to always reference only the root site collection style library. But if you are doing this, then why are you using a feature, you are making it more difficult for yourself.

I hope this helps.

OTHER TIPS

I believe the issue here requires clearing the issue of "root site collection vs other site collections" as each Site Collection in its own is an Isolation boundary, be it root or not. Basically the practice of deploying at Site Collection level (e.g. using Style Libraries) is a recomanded practice, and also it does follow the same isolation unit as the Site Collection itself.

If you ever consider Sandboxed solutions than this model would also fit. The only major downside is really updating across all site collections when you need to change master page, page layouts which are already in use.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top