我试图在我创建的新组件中添加徽标组件。该项目是使用eclipse aem插件创建的。
My component, that inherits from a native component.
<!DOCTYPE html>
<html>
<head>
<sly data-sly-use.clientLib="/libs/granite/sightly/templates/clientlib.html" data-sly-call="${clientLib.css @ categories='paiva.all'}" data-sly-unwrap/>
<sly data-sly-include="/libs/cq/cloudserviceconfigs/components/servicelibs/servicelibs.jsp" data-sly-unwrap/>
<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>
<title>${currentPage.title || currentPage.name}</title>
</head>
<body>
<div class="page__logo" data-sly-resource="logo"></div>
</body>
</html>
Looking at the content folder我注意到我在组件pagina.html
中添加的组件在内容文件夹中不存在。但是当我向parsys
添加一个组件时,它确实有效。
如果我手动添加组件,它就可以工作。
这是正常的吗?如果没有,我该怎么办?
答案 0 :(得分:2)
使用UI添加组件时,我想你的意思是将它添加到段落系统(parsys)中。当发生这种情况时,在parsys资源下面添加适当资源类型的新资源。
在您的情况下,您静态地包含缺少的资源。吊索然后无法呈现它。
最佳解决方案是在模板中的jcr:content资源下添加“徽标”资源。这样,当最初创建页面时,资源就会存在。
您还可以在包含资源时强制使用资源的resourceType,然后注入合成资源。 (但我会做第一个选择)