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.

1 Answer 1


For me Sitecore.Sites.SiteContextFactory.Sites worked to get all sites.

If you need to know whether it is an SXA site or not, you can check for the property IsSxaSite (something like x => !string.IsNullOrEmpty(x.Properties.Get("IsSxaSite"))

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.