In a multi-site Umbraco setup, accessing the root node on the frontend is straightforward using the Umbraco context. However, when working in the backoffice—particularly within a notification handler—what is the recommended way to retrieve the root node of the current content without manually traversing up (have checked DocumentQueryService and NavigationQueryService) the content tree?
In a notification handler, I would assume you have access to an IContent
. In that case you have an extension method GetAncestorIds()
available, and can find the root note Id from there. From that you can retrieve the root IContent
using IContentService
.