1

I've edited the v4.master in the 'my/' site collection to load a custom css file for styling. The problem is, when a user creates their own personal site it loads the default color scheme. I assume that means each new site gets a copy of the default v4.master and not my edited version. Is there an easy way to make is so that, by default, all new personal sites load my custom css?

1 Answer 1

2

Delegate controls can do that for you.

Elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control
    Id="AdditionalPageHead"
    Sequence="1000"
    ControlSrc="~/_controltemplates/MySites.Branding/MySitesCss.ascx">
  </Control>
</Elements>

MySitesCss.ascx:

<!-- Header omitted for brevity/clarity -->


 <!-- Add custom css registration -->
<SharePoint:CssRegistration ID="CssRegistration1" Name="/_layouts/1033/styles/MySites.css" runat="server" After="minimalv4.css" />
2
  • Thanks. How do I create/edit these?
    – LoneWolfPR
    Commented Jan 29, 2013 at 16:59
  • The most common way is to use MS Visual Studio. There are several tutorials on how to create a feature to use delegate controls. Here is one that gets you within striking distance of the above code: weblogs.asp.net/sreejukg/archive/2011/10/27/…
    – ghangas
    Commented Jan 29, 2013 at 17:09

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.