Sunday, September 23, 2012

Site Image Logo in SP 2010

 

Seems very simple, when it comes to setting up a Logo Image for your SP 2010 Site and its sub-site.

Use the LogoImageUrl to set the path of the image (say in “Layouts” folder) in the <SharePoint:SiteLogoImage> as seen below:

<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/">
             <SharePoint:SiteLogoImage LogoImageUrl="/_layouts/mysitename/my_site_logo.gif" runat="server"/>
</SharePoint:SPLinkButton>

But things get a little complicated, if a Site Admin sets a different image in the [Site Settings] – [Title, Description and Icon] under “Look and Feel”.

image

It seems that this property tends to override the master-page LogoImageUrl in the <SharePoint:SiteLogoImage> as shown in the code above.

So the Solution:

- Clear the [Title, Description and Icon] field under “Look and Feel” section in [Site Settings]. I mean set it to blank or update it to the same image as set in the master-page.

But what if you have 100s of sites/sub-sites (in my case, there were 1500 sub-sites).

Power-shell to our rescue….

PS script can help us do the update needed very conveniently. That’s why we all love PS in SP 2010.

So here it is. Simply replace your own site URL and the Image path and run this script.

$site = Get-SPSite http://www.mysitename.com
$site.AllWebs | foreach { $_.SiteLogoUrl = "/_layouts/mysitename/my_site_logo.gif"; $_.Update() }
$site.Dispose()

That’s all we need to do.Have a nice day !!!