Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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? –  Bruce Sep 13 '12 at 14:40
    
Using the CssRegistration object will allow for this behavior. –  CMN Sep 14 '12 at 12:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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