I am trying to get the path of page where the component is currently rendering. Currently my component is in experiece fragment, but I want the path of page where it is rendering.
PageManager pageManager=resourceResolver.adaptTo(PageManager.class);
Page currentPage = pageManager.getContainingPage(resource);
String pagePath = currentPage.getPath();
pagePath is giving me the path of experience fragment I cant get the path of page where it is loading.