Thursday, July 12, 2012

How to set URL of the site logo link

Hi everyone :)
I am not much of expert when it comes to SharePoint branding, but recently I needed to solve simple task and because I don't want to forget it I will paste it here :)
Requirements were very simple - SharePoint mastePage has site logo which is usually link to somewhere. You can change this URL in SPDesigner and manually write URL like this "http://www.mySharePointServer.com/", but I wouldn't recommended this approach 'cause if you have at least testing server you would have to change it there to and who wants to remember a lot of stuffs to change after you migrate your master page into different environment :)
So I found this two common variations which you can use to satisfy your requirements (As I wrote before I am not much of expert so there must be more methods to create generated URL and if you know some of them please do not hesitate to comment it. I would be glad to read it).

Link to the root site of the site collection:

<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" id="onetidProjectPropertyTitleGraphic">
<SharePoint:SiteLogoImage name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl=" ~sitecollection/ /PublishingImages/Logo.jpg" runat="server"/>
</SharePoint:SPLinkButton>


Link just to the top of the current site:

<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/" id="onetidProjectPropertyTitleGraphic">
<SharePoint:SiteLogoImage name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl=" ~sitecollection/ /PublishingImages/Logo.jpg" runat="server"/>
</SharePoint:SPLinkButton>

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks at bing

    ReplyDelete