本文介绍了cq5-livecopy-如何分辨页面何时是实时副本并查找其父母的孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的设置有多个网站,其中一些是主站点的实时副本。我们正在尝试确定我们所在的页面是否为实时副本。如果是这样,请尝试获得其父母和父母的子女。

Our setup has various websites and some of which are livecopies from the main site. We are trying to determine if the page we are on is a livecopy. If so try and get its parent and the children of the parents. This allows us to determine each pages siblings to then use how we want.

使用cq可以轻松实现吗?

Is this easily achievable using cq?

推荐答案

检查页面是否为实时副本

您可以使用,可从资源解析器修改:

You can use LiveRelationshipManager, adaptable from resource resolver:

resourceResolver.adaptTo(LiveRelationshipManager.class)

它具有方法和方法:

Use PageManager and Page methods:

// resource - current component resource
ResourceResolver resolver = resource.getResourceResolver();
PageManager pageManager = resolver.adaptTo(PageManager.class);
Page currentPage = pageManager.getContainingPage(resource);
Page parentPage = currentPage.getParent();
Iterator<Page> siblings = parentPage.listChildren();

这篇关于cq5-livecopy-如何分辨页面何时是实时副本并查找其父母的孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:07