【发布时间】:2025-12-09 20:05:01
【问题描述】:
我正在尝试使用 Groovy 将蓝图页面推出到特定的 Live Copy 页面。以下脚本适用于 AEM 6.5,但它会推广到所有 Live Copy。它忽略了“目标”。
如何限制在 target_path 变量中指定的页面的推出?
import com.day.cq.wcm.msm.api.RolloutManager;
import com.day.cq.wcm.msm.api.RolloutManager.RolloutParams;
source_path = '/content/mysite/en/about-us';
target_path = '/content/mysite/en_us/about-us';
resource = resourceResolver.getResource(source_path);
masterPage = resource.adaptTo(Page.class);
rolloutParms = RolloutParams.newInstance();
rolloutParms.master = masterPage;
rolloutParms.targets= target_path;
rolloutParms.isDeep = false;
rolloutParms.reset= false;
def rolloutManager = getService('com.day.cq.wcm.msm.api.RolloutManager');
rolloutManager.rollout(rolloutParms);
【问题讨论】:
-
可能是您没有正确设置目标。您可以尝试更新
rolloutParms.targets= [target_path];吗? -
感谢@phemanthkumar28。将 target_path 放在括号中解决了这个问题。 target_path = ['/content/mysite/en_us/about-us'];
-
很高兴它成功了。
标签: aem