I have created subsites below my main SharePoint Online site, and I want to use the "modern" style to them (as their respective start page). No custom master page involved.

On clicking the logo top left, I am by default directed to the subsite itself, but I want to be directed to the main site again, like a Home link. This should be very simple. But what is the simplest way?

EDIT: I realize that I need to make an spfx extension or spfx webpart to accomplish this, for a "modern" page. Any guidance is welcome. Maybe something like the old script editor is the way to do it?

1 Answer 1


There seems to be no solution to this other than altering the masterpage or adding custom javascript (spfx extensions for modern) that changes the url every time a user loads the subsite.

I would recommend that you start here: Getting started. You would probably end up putting it in the top placeholder with code that replaces the href tag on the anchor element. Something like this.

var logoLink = document.querySelector('a.ms-siteLogo-defaultLogo');
logoLink.href = 'https://sitecollectionurl.sharepoint.com/sites/a';

Have a look in this sharepoint stackexchange thread where exactly this question has been answered but for classic experience: Change the location that the site page logo points to.

  • Thank you very much, brannmar! But the links are from 2014-15 and do not apply to me if I want to use "modern" pages; they all assume you can edit a master page, or inject some javascript. However that you're saying first, about an spfx extension using new SharePoint Framework, is the way to go I believe. But much work for little gain, in this case. Luckily I have already installed NodeJS and most of the package to do spfx extensions, if you know more specifically about doing this in an spfx, you are free to tell me. Thanks again.
    – Perry J
    Mar 8, 2018 at 8:35
  • @PerryJ I updated my answer with a bit more information regarding your question. Mar 8, 2018 at 13:47
  • @brennmar, Yes I saw! Thanks again! Will have a look at the tutorial, I thought that I had already done this, but that was about spfx webparts, this is about spfx extensions! :-)
    – Perry J
    Mar 8, 2018 at 14:21
  • Sorry I mis-spelled your name! I will read about the placeholders involved and be back soon!
    – Perry J
    Mar 9, 2018 at 13:47
  • It seems like I can add placeholders for a header (top) and a footer (bottom) area, and in the header I can add an additional logo and set a link to it. This is not exactly what I as looking for, but that is not to say it is a bad thing. Maybe it is even better than I thought. I could leave the site logo linkage as-is and have the home logo in the top header just above it. Need to think about it!
    – Perry J
    Mar 13, 2018 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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