1

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?

Thanks!

EDIT:

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.

closed as off-topic by Dan Sinclair, Patrick Barron, Dylan Young, Sitecore Sam, Hishaam Namooya Feb 7 at 6:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Dan Sinclair, Patrick Barron, Dylan Young, Sitecore Sam, Hishaam Namooya
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Have you set a breakpoint in your controller/service code to ensure that it's getting generated properly? – Dan Sinclair Feb 6 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. – Justin Bradley Feb 6 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. – Justin Bradley Feb 6 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! – Justin Bradley Feb 8 at 19:09
0

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.