When working with with SXA inside of a multi-tenant solution, we are building a component to generate an HTML sitemap.

We have implemented a recursive function to generate the html sitemap dynamically based on the content tree structure. We have created a class called SitemapNode (which is basically a linked list) that is populated recursively within our controller.

Here is a sample of the SitemapNode class structure: enter image description here

We then recursively render it within the view: enter image description here

We are able to see the rendered sitemap when navigating to the page in preview mode or otherwise.

However, when opening the same page in Experience Editor, the rendering does not appear. The rendering shows in the presentation details but the html is not there when I 'inspect element' in the browser dev tools.

When clicking "Add" on the placeholder we can also add the rendering, but again nothing is shown in Experience Editor. This message can be seen in the browser console trying to add the same rendering through the Experience Editor. enter image description here

We are using GlassMapper - SitecoreContext.GetHomeItem<IGlassBase>() to get the top node and it appears to be returning sitecore/content/home item.

Does anyone know the proper way to get the context of home item within a tenant using SXA?



The item we wanted is under /sitecore/content/TenantName/Sitename/Home. Was able to use the correct syntax of: MultisiteContext.GetSiteItem(Sitecore.Context.Item); to get the correct item.

  • 1
    Have you set a breakpoint in your controller/service code to ensure that it's getting generated properly? Feb 6 '19 at 18:08
  • @DanSinclair - Thanks. We did some debugging in the experience editor and found that the context of the page being rendered changed from the tenant specific location to sitecore/content. I failed to mention before that we are in a multi-tenant solution. With some modifications to the service logic, we have resolved this issue. Thanks again for your help. Feb 6 '19 at 19:12
  • 2
    @DanSinclair and anyone else - for more context on the solution - We were using 'SitecoreContext.GetHomeItem<IGlassBase>();' and in Experience Editor, this returns the /sitecore/content/Home item. However, since we're in an SXA multi-tenant solution, the item we wanted is under /sitecore/content/TenantName/Sitename/Home. After debbuging in the Experience Editor, we found that we needed to use 'MultisiteContext.GetSiteItem(Sitecore.Context.Item);' to get the correct item. Feb 6 '19 at 21:04
  • @DanSinclair - I made some edits to the question in an attempt to re frame it to help others. I am kind of new around here and would like to see if I can get it re opened. Thanks! Feb 8 '19 at 19:09

Set a breakpoint in your controller/service code to see if the content is being returned and shaped as you expect.

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