2
votes

I have created a main site and I have created many subsite under the main site.

When I am in any main page and click on the logo icon, the page redirects to the home page.

But, when I am in any subsite and click on the logo icon, the page redirects to the subsite homepage rather than the main hompage.

I would like to change the navigation URL to the root site. Let me know if I have to edit any masterpage, or is there any common page that will inherit to all the child application.

Thanks

2

2 Answers

2
votes

We have 2 ways to do this.

Method 1:

  1. From the Snippet Gallery, copy and paste the default SiteLogo code snippet into your master page into the appropriate place you want it to be displayed.

  2. In the SiteLogo code, search for SharePoint:SPSimpleSiteLink to find the relevant opening and closing tags. Now simply change the tag names to SharePoint:SPLinkButton instead.

  3. Then simply add the attribute NavigateUrl to this tag and set it’s value to “~sitecollection/”.

Example:

Default snippet code:

<!--MS:<SharePoint:SPSimpleSiteLink runat="server" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">--> ... <!--ME:</SharePoint:SPSimpleSiteLink>--> Should become this:

<!--MS:<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">--> ... <!--ME:</SharePoint:SPLinkButton>-->

Ref link

Method 2:

We are going to add custom js in the master page => our site is a publishing site

We find the site logo in the below hierarchy(in a rendered page).

    <div id='DeltaSiteLogo'>
        <a href='site url'>
            <img src='siteIconPath.png/whatever extension'/> 
        </a>
    </div>

So we may try the following for redirecting to the site collection/root web url on click of the logo.

// Add the following js in the '.html' design file that associates with the corresponding masterpage.

    <script type="text/javascript">//<![CDATA[
    $(document).ready(function(){
      $("div#DeltaSiteLogo a").attr("href",_spPageContextInfo.siteAbsoluteUrl);
    });
    //]]>
    </script>
0
votes

It works. Edit on the SharePoint Designer Master Pages > seattle.master . Crtl F - Search for DeltaSiteLogo

DEFAULT:

<SharePoint:SPSimpleSiteLink CssClass="ms-siteicon-a" runat="server" id="onetidProjectPropertyTitleGraphic" >
        <SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
    </SharePoint:SPSimpleSiteLink> 

Change To This (copy & paste the script):

<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" CssClass="ms-siteicon-a" ID="x7917ecc8c38d4bd69f58e338eab54c8c">
        <SharePoint:SiteLogoImage CssClass="ms-siteicon-img" name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="/_layouts/15/images/siteIcon.png?rev=47" runat="server"/>
    </SharePoint:SPLinkButton>