adobeaemcrx

Adobe AEM | Component is not being created in content folder


I'm trying to add a logo component inside a new component that I've created. The project was created using the eclipse aem plugin.

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 I noticed that the component that I added in my component pagina.html does not exists at content folder. But when I add a component to the parsys, it does work. If I add the component manually, it works.

Is that normal? If not, what should I do?


Solution

  • When you add a component using the UI, I suppose yo mean adding it to a paragraph system (parsys). When that happens a new resource of the appropriate resource type is added below the parsys resource.

    In your case, you are statically including a resource which is missing. Sling then cannot render it.

    The best solution is to add a 'logo' resource below the jcr:content resource in your template. That way the resource will be there when the page is initially created.

    You could also force the resourceType of the resource when including it, then it would inject a synthetic resource. (but I would do the first option)