Adobe AEM |组件未在内容文件夹中创建
问题描述:
我试图在创建的新组件中添加徽标组件。该项目是使用eclipse插件创建的。Adobe 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
时,它确实有效。 如果我手动添加组件,它将起作用。
这是正常的吗?如果不是,我该怎么办?
答
当你使用UI添加一个组件时,我想你是指将它添加到段落系统(parsys)。当发生这种情况时,在parsys资源下添加适当资源类型的新资源。
就你而言,你是静态地包含一个缺少的资源。吊索然后不能渲染它。
最好的解决方案是在模板中的jcr:content资源下面添加一个'logo'资源。这样,页面最初创建时资源将在那里。
您也可以在包含资源时强制资源的resourceType,然后注入合成资源。 (但我会做第一个选项)
嘿@santiagozky,谢谢你的回答。其实,第一种选择完全合理。但仍然不行:/。我在模板中添加了标识组件,甚至创建了一个新页面。同样的错误。 –
嘿@santiagozky,我创建了一个新的模板,它工作,但..似乎我需要创建一个新的页面,每次我添加一个新的组件到我的模板。 –
@italoPessoa,这是正确的。更新模板时页面不会更新! – santiagozky