In a nutshell, the JSS app's config patch (usually deployed to \App_Config\Include\zzz\my-jss-app.config
) is resolved before SXA sites.
When the SXA module is installed in Sitecore, you get a bunch of new configs. Of particular interest for this issue is this patch file that says where to place the SXA sites:
<!--\App_Config\Include\Z.Foundation.Overrides\Sitecore.XA.SitesToResolveAfterSxa.config -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<experienceAccelerator>
<siteResolving>
<site name="exm" resolve="after" />
<site name="website" resolve="after" />
</siteResolving>
</experienceAccelerator>
</sitecore>
</configuration>
This patch file is saying to place the SXA sites before the default website
<site>
. If you check out /sitecore/admin/showconfig.aspx
on your website, you'll see that SXA sites are not rendered in the final config under the <sites>
section. So at the point of resolving the SXA sites, your JSS app config has already been resolved and the SXA sites are going to be put behind it, between the JSS app and the default website
.
In order to fix this I needed to create a new patch file adding my JSS site to this of <site>
s to ensure the SXA sites are placed before it (your JSS root site):
<!--\App_Config\Include\zzz\my-jss-app_sxa-patch.config -->
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<experienceAccelerator>
<siteResolving>
<site name="my-jss-app" resolve="after" patch:after="site[@name='website']" />
</siteResolving>
</experienceAccelerator>
</sitecore>
</configuration>
By doing this, in the SXA Site Manager, you'll see your SXA sites are now listed before your root JSS site.