1

I have a SharePoint 2010 farm that will have thousands of site collections in it. Each site collection will be a personal externally facing publishing site collection for individual employees. Each employee can create publishing and blog subsites.

I have an event receiver with webadding and webprovisioned events in it where I can add additional code if needed. Currently I'm using these events to enable the publishing feature in the blog so it looks like the parent site.

How can I get these user created blogs to load a custom CSS file located in the styles folder within the 14 hive (easy for me to update it if it's here)? I want to avoid having the CSS also load for all the site templates, and only load for the blog template.

Is there some way to accomplish this within my master page? Perhaps some way to tell it to only register my CSS if the site currently loaded is a blog?

1 Answer 1

2

You could use a delegate control to add additional content on the masterpage. You'll most likely want to use the AdditionalPageHead. Information on how to setup this up can be found here: http://msdn.microsoft.com/en-us/library/ms470880.aspx

As far as loading it only when you are on a blog site, you could check the SPContext.Current.Web.WebTemplate property. If you follow the example above, you would only call the RegisterClientScriptBlock() method if WebTemplate property is equal to "BLOG#0" (I believe that's the name). To link to a CSS file, you could output the tag directly or use the CssRegistration object.

2
  • Will using this method allow for themed CSS to be processed by SharePoint's theme engine? Or is there an extra step needed to make that happen?
    – SF1Dev
    Commented Sep 13, 2012 at 14:40
  • Using the CssRegistration object will allow for this behavior.
    – CMN
    Commented Sep 14, 2012 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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