Add your company logo to all sites in a site collection

One common request from customers when it comes to SharePoint Customization is, How do I add my company logo to the site? This was common in V2, and it’s just as common with 2007.

You might be quick to point out that in 2007 “Hey that’s easy, you can do it from the browser by selecting Site Title, Description and Icon from the Site Settings page right?.

While you would be correct in saying this, what happens when the customer creates sub sites and while navigating through these sites realizes hey wait a minute, where’s my logo – you fraud!

While the OOTB functionality is great for specifying the logo on a site by site basis there is no way to have this inherited by all sub sites which are created there after. If you create 20, 30, 40 subsites, you would be forced to change the logo in the site settings of every site.

This easily forseeable crisis which you will inevitably face at some point is actually easy to deal with thanks to the power of .MASTER pages.

Getting started adding a company logo to the master page:

  • Browse to the top level of your site collection in the browser.
  • From The Site Actions Menu, Select View All Site Content
  • Select the Site Collection Images Library
  • Upload your Company Logo (companylogo.gif) – If required, approve this image.
  • Open SharePoint Designer 2007 and Select File, Open Site. Type the URL of the top level of your site collection.
  • Locate the master page gallery in the left pane. _catalogs\masterpage
  • Double click the default.master (you may be prompted to check it out – if so choose yes)
  • Search For: <SharePoint:SiteLogoImage id=”onetidHeadbnnr0″ LogoImageUrl=”/_layouts/images/titlegraphic.gif” runat=”server”/>
  • Repace With: <asp:Image runat=”server” id=”logo” ImageUrl=”< %$ SPUrl: ~sitecollection/sitecollectionimages/companylogo.gif %>/>

What the above does is replace the default (site by site) mechanism for replacing the company logo with a hard coded reference to the company logo which you uploaded to the Site Collection Images library.

By doing this, all pages which inherit from the top level default.master will be updated to reflect this change. Each time you create a sub site, simply inherit the master page of the parent site to ensure this behaviour remains in tact.

Happy Customizing,

This entry was posted in SharePoint 2007. Bookmark the permalink.

32 Responses to Add your company logo to all sites in a site collection

  1. Renaud Comte says:

    Just one point

    >>> in this case, the ghost of the master page become broken no ?

  2. shane says:


    Yes I suppose by definition the master page would then be un-ghosted.

    That being said,

    - The master page is stored in the gallery of the site so after the sites been provisioned I am not sure it matters.

    - Other pages can still inherit from it.

    Because of those two points I think Ghosting is not as much an issue now.

  3. Renaud Comte says:

    Perhaps the best way is to change the MP file and add it as a new one with the feature ?

  4. shane says:

    Quite a few people have emailed me saying that they’re getting errors such as “Invalid Identifier”.

    The problem is when you cut and paste the code from here, to SharePoint Designer, the ” (Quotes) get messed up, they look Italic. REDO all the ” in the code and it should work fine.

  5. galen says:

    Is this still the best method to add a company logo to all subsites?

  6. shane says:

    It’s the best way I have found and still use frequently.

  7. Raj says:

    we are trying to customize the look and feel in SP07 by adding a logo
    image to the top bar where the link to home is currently present. I
    was able to display to image properly but was unable to make it a
    hyperlink (to the homepage) like the earlier text used to be. How do I
    do that? is it possible?

    here is my code from the default.master-

  8. Pingback: I Learned It Online » Blog Archive » Branding SharePoint 2007 - Make it Personal

  9. Laith says:

    When trying to get this to work I am getting “The expression prefix ‘SPUrl’ was not recognized. Please correct the prefix or register the prefix in the section of configuration.”

    Could this possibly be because we are running WSS 3.0 rather than MOSS?


  10. Paul Lister says:

    How do you do this if you don’t have Sharepoint Designer 2007?


  11. Batman says:


    This code didn’t work for me in SharePoint Designer 2007:


    It doesn’t recognize the SPUrl command I think.

    My problem is, I can add a logo to the first team site I create, but any subsequent team sites have their own default.master page because when you create a new Team Site, you are required to enter a new part of the url from your main site.


    Team Site 1 and 2 have their own default.master pages. I want to have the logo on all the team sites, not just Team 1.

    Any ideas?

  12. Sami Hamed says:

    Hi -

    I am facing the same problem using SharePoint 07. I got the following message:

    “Error Creating Control – logoThe expression prefix ‘SPUrl’ was not recognized. Please correct the prefix or register the prefix in the section of configuration.

    Any tips?

    Thanks for your help,

  13. amit says:

    i am new to sharepoint
    after replacing this line [ SharePoint:SiteLogoImage id=”onetidHeadbnnr0″ LogoImageUrl=”/_layouts/images/titlegraphic.gif” runat=”server”/> ]
    with this
    [" /> " ]

    i am getting error
    Error creating control – logo
    The server tag is not well formed.

    please do help me and also tell me how can i add the company logo on right side


  14. Marten Van Laan says:

    Hey Shane

    Thanks much for this post. I had some issues with the code, but got it working with this snippet:

    Are there implications to using what I used versus what you used? How important is the %$ SPURL portion of the code?

    Also, I’d like to reiterate Batman’s question and ask, after an upgrade, how can this be propogated to team sites which were brought over as all their own site collections? Is there a magic bullet there?


  15. Dana says:

    Well, first off there’s a missing closing quote in the sample code. Secondly, while Designer will show an error, it seems to work in SPP. I had to change the path for my image to ~/sitecollections/publishingimages/logo.jpg. Probably because my main site is a publishing site? Anyway for those still having trouble, here’s the code that works for us…


  16. pragaw says:


    is missing the closing quote.

    it s/b:


  17. Terry Showers says:

    I also am getting the error “SPUrl was not recognized. Please correct the prefix or register the prefix in the section of configuration”

    I see several references to this but no solution.

    Am I missing something.

    By the way your book “Beginning SharePoint 2007″ is Great!

    Thanks in advance

  18. Lance says:

    Has anyone resolved the issue with the $SPUrl: not being recognized as a valid expression/prefix?

    Some documents I’ve found on the net say that the Microsoft.Sharepoint.Publishing.Webcontrols enable this, although I can’t find any proof to confirm this.

    Is this specific to MOSS 2007, or is this accessible from WSS 3.0?

    As far as I can tell, $SPUrl is ASP.NET expression syntax that let’s you access configuration settings and resources by name/key and spitting out a value to replace anything in the form of $___:. Is there some config file that is making this setting at runtime?

    If so… when, where, and how?

  19. Kathy says:

    After replacing the line, I am also getting the error:

    “An error occurred during the processing of /_catalogs/masterpage/default.master. The server tag is not well formed.”

    Anyone have a solution?

  20. Rakesh says:


    Just remove “/” from master page string…

    i.e. from “/_catalogs/masterpage/default.master” to “_catalogs/masterpage/default.master”

  21. Hammad says:

    I am using master page at site collection level that has a banner. I want this master page to be used by all the sub sites. Subsites are inheriting Master page of the Parent website(Site Collection). Every sub site has its own individual banner in the images directory. Is there a way that the master page at site collection level pick banners from the relative sites?

  22. Pingback: SharePoint Styles and Modifications « IS Department

  23. ramya says:

    your post was very useful,i found that after uploading the image into site collection image i can directly browse for the url from sharepoint designer (Sitecollection Images folder) instead of typing the URL.Moreover after creating a subsite i could not see the subsite inheriting the the logo from the

    I would require one more help , i want to add the logo to the CREATE & SITE SETTINGS page also.
    will you please help me with the procedures of how to do it.

    Thanks in advance!

  24. many people have asked about this error in SPD

    “Error Creating Control – logoThe expression prefix ‘SPUrl’ was not recognized”

    It looks to me its a bug in SPD, as it is not able to recognise the tag “$SPUrl”. But everything works fine when you browse the web site. But when you edit the page in SPD, you cannot view the page how it looks like because of this error.

  25. Kirsten says:

    I found a much simpler way to do this that does not produce the error in SharePoint Designer:

    1. Find the line: and:
    2. Replace id=”onetidHeadbnnr0″ with, for example, id=”onetidHeadbnnr1″
    3. Replace the url address with your own – eg:

    Best regards,

  26. Of course if your SharePoint is running only sites for one company, it could just be easier to replace the titlegraphic.gif file on every front end server with your company logo saved as titlegraphic.gif.

    that’s the way i do it :)

  27. David Attard says:

    Nice tip,

    If you do this via SharePoint Designer on a dev site collection, will this have to be done again on a production site collection when this is migrated?

  28. Pingback: I Learned It Online » Branding SharePoint 2007 - Make it Personal

  29. John says:

    I am customiziong the Master Page at root level and applying to all site and subsite. But on Subsite the master page BANNER is not showing. But the sre is expanded for the image but image is not there. What is resolution of the problem.

  30. Ingrid says:


    I want to change the portal image of my site. I´ve done the following steps:

    - On the menu, click Site Settings, and then click Modify All Site Settings.

    In the Look and Feel section, click Title, description, and icon.

    In the URL box, type the location of the graphics file for the logo that you want to use.

    I´ve checked the URL and it was Ok.

    Now, when I displayed the portal site with the uploaded image I couldn´t see it. There was a square with a red cross in the middle. I tried with an image.gif and an image.jpg, but I couldn´t.

    Well, I supposed that the portal site image had got an specific format, which I didn´t know.

    Thanks in advance,

  31. Leon says:

    To fix: ‘SPUrl’ was not recognized

    This works for me:

  32. Sohel Rana says:

    $SPUrl works for MOSS and depends on publishing feature. So if you use WSS then SPUrl will not work.