In order to render alternate URL metadata, I need to get a SiteInfo object (Sitecore.Web.SiteInfo
) for other sites apart from the context site.
I have tried to use
var otherSiteInfo = ServiceLocator.ServiceProvider.GetService<ISiteInfoResolver>().GetSiteInfo(otherSiteItem);
but this does not seem to work correctly. It returns the site named "website" (from the Sitecore.config).
One other thing I noticed with the above technique was that when getting the current site's SiteInfo, the site with the "web" database was returned, despite Sitecore.Context.Database being "master".
From this I assume that either a) I'm going about this the wrong way and using the wrong API or b) there is a bug with this part of SXA?
I'm using Sitecore 9.0.2 and SXA 1.8 rev. 181112.