Link site logo to Site Collection URL

When working with SharePoint masterpages knowing available tokenscomes really handy. E.g. Standard masterpage will have a logo image that will always link to default page of current site. Usually, you want to link logo to top level site.

This logo is linked to current site. E.g. http://server/sites/test/subsite

<SharePoint:SPLinkButton runat=”server” NavigateUrl=”~site/” id=”onetidProjectPropertyTitleGraphic” >
<SharePoint:SiteLogoImage name=”onetidHeadbnnr0″ id=”onetidHeadbnnr2″ LogoImageUrl=”/_layouts/images/siteIcon.png” runat=”server”/>
</SharePoint:SPLinkButton>

This logo is linked to root site. E.g. http://server/sites/test/

<SharePoint:SPLinkButton runat=”server” NavigateUrl=”~sitecollection/” id=”onetidProjectPropertyTitleGraphic” >
<SharePoint:SiteLogoImage name=”onetidHeadbnnr0″ id=”onetidHeadbnnr2″ LogoImageUrl=”/_layouts/images/siteIcon.png” runat=”server”/>
</SharePoint:SPLinkButton>

2 Responses to “Link site logo to Site Collection URL”

  1. jeff

    Hello, do you know how to tell the link to go to the parent site ? like ~siteparent :) ?

    Reply
    • horsik

      Hi Jeff, as far as I know – no out of the box way to get this value. One solution – You may need to write little control or webpart to store this value somewhere hidden on the page. Depending what you want to use it for?

      Reply

Leave a Reply