【问题标题】:Adobe AEM | Component is not being created in content folderAdobe AEM |未在内容文件夹中创建组件
【发布时间】:2017-05-31 11:45:59
【问题描述】:

我正在尝试在我创建的新组件中添加徽标组件。该项目是使用 eclipse aem 插件创建的。

My component, that inherits from a native component.

My content 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>

My template

My template details

A page using the template

The error

Looking at the content folder 我注意到我在组件pagina.html 中添加的组件在内容文件夹中不存在。但是当我向parsys 添加一个组件时,它确实有效。 如果我手动添加组件,它可以工作。

这正常吗?如果没有,我该怎么办?

【问题讨论】:

    标签: adobe aem crx


    【解决方案1】:

    当您使用 UI 添加组件时,我想您的意思是将其添加到段落系统 (parsys)。发生这种情况时,将在 parsys 资源下方添加适当资源类型的新资源。

    在您的情况下,您静态地包含了一个缺失的资源。然后 Sling 无法渲染它。

    最好的解决方案是在模板中的 jcr:content 资源下方添加一个“徽标”资源。这样,在最初创建页面时,资源就会在那里。

    您还可以在包含资源时强制资源的 resourceType,然后它会注入合成资源。 (但我会做第一个选项)

    【讨论】:

    • 嘿@santiagozky,谢谢你的回答。实际上,第一个选项完全有道理。但还是不行:/。我在模板中添加了徽标组件,甚至创建了一个新页面。同样的错误。
    • 嘿@santiagozky,我创建了一个新模板,并且成功了,但是.. 似乎每次我向模板添加新组件时都需要创建一个新页面。
    • @italoPessoa,这是正确的。更新模板时页面不会更新!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多