I've followed these instructions to change the default header of the SharePoint(2013)'s site.
The code I used is this:
$webApp = Get-SPWebApplication https://<intranet>
$webApp.SuiteBarBrandingElementHtml = "<div class=""ms-core-brandingText""><a href=""https://<intranet>""><img alt=""https://<intranet>/SiteAssets/Logo.png"" src=""../SiteAssets/Logo.png"" /></a></div>"
$webApp.Update()
What I tried to achieve by this is a kind of hack to have a different kind of image for each of my site across the site collection. So basically the header retrieves the image from its own SiteAssets -folder where I've placed the Logo.png. As expected, I'm only using the same name, but the image varies.
Now this works totally fine and as expected, except once I access any content of the site which has the ".../_layouts/...
" -path in it. So for example once I go to site's Site settings or Site contents the image gets broken. If I follow the path of the image it shows it as ".../_layouts/SiteAssets/Logo.png
" which is actually a totally blank page.
I thought this could be passed by using some kind of if -statement on Management Shell, but I haven't got it working at all - don't know if it's even possible.
My current goal is to have those broken images replaced by the default image which is located at the root, https://[intranet]/SiteAssets/Logo.png
. Of course the Site settings pages could have their own logos too, but for now I'd be happy with even some sort of fix for this issue.
Also should I mention that this problems exists on My sites too. I have the My sites created as a site collection under the root web application. The paths under my sites are like this:
Broken image link: https://[intranet]/sites/SiteAssets/Logo.png
The actual path for the link: https://[intranet]/sites/my/SiteAssets/Logo.png