I need to change the link of the Logo image for all sub-sites to point to the main site instead of the sub-site itself. Looked around quite a bit, but all posts seem to be suggesting to replace something on the master page which isn't there (at least not on my master page), or to add some java script to some location which isn't there either (again, at least not in my site). My guess is, that the solutions are simply not compatible with SharePoint Online (SPO).

Anyone know how this could be done efficiently in the current SPO? Preferably through the SharePoint Management Shell rather than SPD (2013) or the SPO Web GUI.

1 Answer 1


Try with this UsercustomJSActions. Create .js file with this code http://bexgordon.com/2015/10/use-javascript-to-change-the-logo-of-sharepoint-site-to-the-site-collection-url/


function SetHomeLink()
    var siteCollectionUrl = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl;  
    var oldLogoId = $("#DeltaSiteLogo > a").attr('id');
    $("#" + oldLogoId).attr('id','CustomSiteLogo');
    $("#DeltaSiteLogo > a").after("<a id='tmpDeltaSiteLogo' href='#' style='display:none'>Dummy</a>");
    $("#tmpDeltaSiteLogo").attr("id",oldLogoId );
    $("#CustomSiteLogo").attr('href', siteCollectionUrl);

for var siteCollectionUrl you could set ~sitecollection/

Inject JavaScript https://www.tonyishere.co.uk/tag/javascript-injection/

#Run all of your lines to load the context of the site collection

#add custom js injection action
$customJSAction = $site.UsercustomJSActions.Add();
$customJSAction.Location = “ScriptLink”;
#reference to JS file
$customJSAction.ScriptSrc = “~SiteCollection/Style Library/JS Display Templates/test.js”;
#load it last
$customJSAction.Sequence = 1000;
#make the changes

Change the location that the site page logo points to


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.