Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SharePoint Redirect site logo link to the root site collection home page

I want the site logo link in the master page to always redirect to the root site collection home page. Default behavior is to redirect to the homepage of the current web (spweb).

Back in SharePoint 2010 I could accomplish this by adding the NavigateUrl attribute to the SPLinkButton control in the master page with a value of ~sitecollection like this:

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

However in SharePoint 2013 the control for the site logo link has changed in the master page to SPSimpleSiteLink. I have tried setting the NavigateUrl property for this control in the same way but it does not seem to work anymore.

<div id="siteIcon" class="ms-tableCell ms-verticalAlignTop">
  <SharePoint:AjaxDelta id="DeltaSiteLogo" BlockElement="true" runat="server">
    <SharePoint:SPSimpleSiteLink NavigateUrl="~sitecollection/" 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=23" runat="server"/>
    </SharePoint:SPSimpleSiteLink>
  </SharePoint:AjaxDelta>
</div>

As a workaround, I have now removed the AjaxDelta wrapper control and changed the SPSimpleSiteLink to the old SPLinkButton with the added NavigateUrl attribute. This seem to work.

Are there any better ways?

like image 566
gurkan Avatar asked Nov 27 '12 10:11

gurkan


People also ask

How do I change the homepage URL in SharePoint?

Change a site address in the new SharePoint admin centerTo open the details pane, select the site name. On the General tab, under URL, select Edit. Enter the new site address, and then select Save.

How do I change the collection URL in SharePoint?

Login to the Modern SharePoint Admin Center >> Click on “Active Sites” under the “Sites” section. Select the site collection you want to rename and open its properties pane. Click on the “Edit” link next to the site URL. Provide a new URL and hit the “Save” button.

What is a root URL SharePoint?

The root site URL for SharePoint Online is provisioned based off your input when setting up your Microsoft 365 subscription. For example, if your organization name is Contoso, the root site for SharePoint Online will be https://contoso.sharepoint.com .


2 Answers

Regarding MSDN SharePoint:SPSimpleSiteLink is a "very simple control which provides a link to the current site This control is compliant as a chrome control in an MDS-enabled master page"

if you want the site logo link always redirect to the site collection root site, use SharePoint:SiteLogoImage (as we was used with SP 2010)

<SharePoint:AjaxDelta id="DeltaSiteLogo" BlockElement="true" runat="server">
<SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/" id="onetidProjectPropertyTitleGraphic">
                    <SharePoint:SiteLogoImage  name="onetidHeadbnnr0" id="onetidHeadbnnr2" LogoImageUrl="images/logo.png" runat="server">
                                </SharePoint:SiteLogoImage>
              </SharePoint:SPLinkButton>

like image 119
Shannak Avatar answered Oct 21 '22 10:10

Shannak


As Muawiyah Shannak mentioned you simply have to replace the SharePoint:SPSimpleSiteLink with the SharePoint:SPLinkButton control.

If you are useing the SharePoint Design-Manager Snippet Tool you have to edit the following two lines (start and end tag)

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

to this

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

It is alays better to use a dynamic control then setting it as a permanent link, so you can reuse your template on other sitecollections without changing the static root link.

like image 39
DaviideSnow Avatar answered Oct 21 '22 11:10

DaviideSnow