Sharepoint - branding sharepoint foundation 2013

Trial and error my friend. However, knowing HTML and CSS combined with Sharepoint Designer...when working with SPF 2013 is in my opinion all you need. I'm pretty much on the same boat as you.

Here are some links I found and will share relative to branding:

Fixed Ribbon and Scroll Bar

This helped me

This is good to understand what css class does what

Just to save you the headache I'll also tell you that it is advised to load in your custom css AFTER sharepoint's css file in the master page. So what it looks like for me is this:

    <SharePoint:CssRegistration name="point to your css file/custom.css" After="corev15.css" runat="server" />

I'm sure there is other stuff that I can't think right now. All in all, have fun. It will frustrate the hell out of you at first but there is always a way. The experts on here have been helpful to me, I'm sure they'll be to you too.

Have fun branding :D


This may be to advanced, but it is an option. You can brand the sites using Visual Sudio.

And even if you choose to do it with designer, don't mess with the default master page, make a copy! And do your branding on a dev environment if possible, you can mess up allot if you do things wrong.

In short, you need to create a new SP 2013 empty project (Farm solution), map the Layouts folder and add a custom CSS. Then add a module (call it Masterpages) and in that add a copy of your master page (you can download a copy from within you SharePoint site under site settings /master pages and layouts) the file is called seattle.master. In VS replace the elements.xml content with this and then change the name to reflect the name of you master.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Masterpages" Path="Masterpages" RootWebOnly="TRUE" Url="_catalogs/masterpage">
<File Url="CustomTeamSite.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
</File>
</Module>
</Elements>

In the master page you need to add the CSS registration.

<SharePoint:CssRegistration ID="CustomCSS" Name="<% $SPUrl:~sitecollection/_layouts/15/Team.Site.Branding/CustomTeamSite.css?v1 %>" After="corev15.css" runat="server" />

Then you need a feature "scope site" that replace the master page on new sites. The feature need a feature receiver to to that. The code within the receiver looks something like this.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
    {
        SPSite site = properties.Feature.Parent as SPSite;

        if (site != null)
        {
            SPWeb topLevelSite = site.RootWeb;

            // Calculate relative path to site from Web Application root.
            string webAppRelativePath = topLevelSite.ServerRelativeUrl;
            if (!webAppRelativePath.EndsWith("/"))
            {
                webAppRelativePath += "/";
            }

            // Enumerate through each site and apply branding.
            foreach (SPWeb web in site.AllWebs)
            {
                // Activate the publishing feature for all webs.
                web.MasterUrl = webAppRelativePath + "_catalogs/masterpage/CustomTeamSite.master";
                web.CustomMasterUrl = webAppRelativePath + "_catalogs/masterpage/CustomTeamSite.master";


                web.Update();
            }
        }
    }


    public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    {
        SPSite siteCollection = properties.Feature.Parent as SPSite;
        if (siteCollection != null)
        {
            SPWeb topLevelSite = siteCollection.RootWeb;

            // Calculate relative path to site from Web Application root.
            string webAppRelativePath = topLevelSite.ServerRelativeUrl;
            if (!webAppRelativePath.EndsWith("/"))
            {
                webAppRelativePath += "/";
            }

            // Enumerate through each site and apply branding.
            foreach (SPWeb site in siteCollection.AllWebs)
            {
                site.MasterUrl = webAppRelativePath + "_catalogs/masterpage/seattle.master";
                site.CustomMasterUrl = webAppRelativePath + "_catalogs/masterpage/seattle.master";
                site.SiteLogoUrl = string.Empty;
                site.Update();
            }
        }
    }
}

When you activate the feature the site will get your new branding.

As i sad this is in short and you can read more about it on my blog where i have a full tutorial.

http://frederik.se/how-to-brand-sharepoint-2013-team-sites-using-feature-stapling-in-vs/

Good luck!

Tags:

Branding