HOpefully a quick one. How to get the site root on a multi-tenant site, in a ViewComponent called from a Block/partial.
var site = content.Root(); works when the ViewComponent is called from a page View but not when called from a partial. Have tried content.Parent.Root() but no joy.
MobyDog
10/12/2023, 1:45 PM
Have also tried variations on a theme with _umbracoContextAccessor but not working, not sure how exactly to do it
MobyDog
10/12/2023, 2:08 PM
IPublishedContent siteRoot = _umbracoHelper.ContentAtRoot().FirstOrDefault(); - got it
MobyDog
10/12/2023, 6:53 PM
Actually what I actually need is the homepage node of the site I'm on. Still struggling - am sure it should not be this difficult, probably missing something really basic. I have tried all sorts of versions of umbracoContext, umbracoHelper etd
MobyDog
10/12/2023, 7:10 PM
think I might have it - @await Component.InvokeAsync("SitemapDownloads", Model.BaseModel); rather than just Model.