AEM 6.1: can't fetch component properties from page nodes - aem

I'm new on AEM and I have an issue:
I'm working on a page named 'ancillary'
I did not create this page, I modified it where it was necessary.
In jcr:content I have page properties.
As you can see from the 1st screenshot:
pas
as
pos
new
are component properties, these should populate my page (ancillary), I'm only working on 'new'. The others are not used anymore since their components are now obsolete.
This is my component which we'll call 'newComponent':
It should be able to fetch 'new' properties (1st screenshot), since in new's sling:resourceType I set path/to/newcomponent.
When I use ${properties.mynewproperty} in newcomponent.html, it won't print the property. I can only reach pageProperties like jcr:title.
My component 'newcomponent' was created as a copy of another component, which it used to lay on the page ancillary and I swapped them. I also created a copy of the node with the oldcomponent's properties. I can see the component on the page on localhost, but I can't render the text properties.
I'm very sorry I explained this very badly, I hope someone understands and manages to help me.

You can't access your 'ancillary/jcr:content/pas' sub-nodes properties for instance. Only properties stored under your 'jcr:content' can be accesed with "${properties.myProperty}. IF you need to retrieve those sub-node properties, you'll have to use a JAVA or JS model to access it.

Related

AEM 6.2 How to change template of a page

I have created live copy of a page branch from sample website, inside my website. I was just trying to update the template so that I can create a local copy of the template used with original page and then change the UI. I can see the property with the cq:template and sling:resourceType as component name in development environment(CRXDE Lite). Can anyone suggest if we can update the property to change the template and component or if there any other way to change the template.
You can update cq:template and sling:resourceType on page/jcr:content node with corresponding new values and it would effectively change the template of page.
you might run into errors if code on new page component is expecting a different content than what is currently under your jcr:content.
ps- I dont know what your use case is but this would be very crude approach and should be avoided.

Can I make a simple page in CQ ?

What is the minimum that I have to do to make a content page and render it in CQ ?
Do I have to have a template ?
Does it have to be a CQ:Page type node with a supertype ?
As mentioned my "Brian",
Short Answer
See:- http://localhost:4502//apps/geometrixx-gov/templates/homepage
create a node of type cq:Page and save, add cq:PageContent node under page node, add required properties to show the component & if you want to add some default node under this cq:PageContent node add all of them manually.
Long Answer
Can we create a page without template?
in this post I will explain it's answer in detail. before knowing the answer of this question just rethink the definition of a Template.
"A template is used to create a Page and defines which components can be used within the selected scope. A template is a hierarchy of nodes that has the same structure as the page to be created, but without any actual content"
when you create a template using crxde lite then it creates two nodes by default having primaryTypes
cq:Template as parent
cq:PageContent as child
When we create a page using template via siteadmin then siteadmin uses content page component & it copies all the child nodes under the template to a newly created page node.
and once the page has been created it doesn't require cq:Template as all the child node of the template copied under cq:Page node & these nodes contains all the required properties to display a component group for that page.
It means if you want to create a page without template you can do that but it's not possible using siteadmin console as it's content page component uses templates to create pages.
you have to do all this stuff manually from crxde i.e.
create a node of type cq:Page and save, add cq:PageContent node under page node, add required properties to show the component & if you want to add some default node under this cq:PageContent node add all of them manually.
It's not a good practice to create a page manually, always use templates as it provides different set of properties which are very helpful while creating pages or websites.
Some of important properties are -
allowedTemplates
allowedPaths (deprecated Now)
allowedParents
allowedChildren
these properties can be used for filtering the page structure using siteadmin console. but if you are creating a page manually then you have to take care about all of these restriction by your own.
Source Link:- http://versatileankur.blogspot.in/2014/07/page-without-template-in-cq5.html
Another Ways:-
Use of Site Importer tool
Link:- https://docs.adobe.com/docs/en/aem/6-2/develop/dev-tools/site-importer.html
It helps in importing static website into AEM.
Creating a Website
Link:- http://www.aemcq5tutorials.com/tutorials/aem-create-a-website-in-cq5/
I hope this would help you.
Thanks and Regards
Kautuk Sahni
The absolute minimum is a node with primaryType of cq:Page (or a subtype) and a child node called jcr:content with a primaryType of cq:PageContent (or a subtype).
Of course, this will render a blank page. To render something on this page, you need to add nodes to the jcr:content node.

Setting sling:resourceSuperType to a carousel and remove property not working in AEM 6.1

I have a test web page that contains one component, a carousel.
That component was copied from /libs/foundation/components/carousel and what i have modified from the copied component was the property:
sling:resourceSuperType from foundation/components/list to foundation/components/carousel.
My next step was to remove a property from the touch dialog (the property Controls Style).
My problem is that in my web page i keep seeing this property even when it was deleted.
Is this because the resourceSuperType is foundation/components/carousel and because this component stills have the property i'm seeing in the dialog?
This behavior was not like this in AEM 5.
My intention was to copy the component, keep the inheritance (resourceSuperType) and modify the copied component.
What i'm doing wrong?
EDIT: Making some tests i figure out that in AEM 6.0 if i delete a property of the carousel (my copied carousel), the property doesn't appear. BUT in AEM 6.1 the property appears. Where can i found this change between the two versions? or is something else?
When creating an overlay, you're going to find all properties from the original component even if they don't exist in the overlay.
You'll have to explicitly remove the property by adding the sling:hideProperties property of type String[] to your overlay. This will allow you to hide the values otherwise inherited from the node from /libs that you're trying to overlay.
I think you'll find the descriptions of various use cases for the sling:hideProperties property in the documentation quite useful.
As part of of it's resource resolution process, the Sling Resource Resolver has search paths that it looks in to locate a resource.
The two most common search paths are /apps and /libs. With the /apps path taking precedence. The most common usage of this in sling:resourceType where the value is defined as the path below one of these search paths. In your case having a sling:resourceType of foundation/components/carousel would originally return the OOTB components under /libs and when you copied it to the /apps directory it would return the component you put under /apps.
This concept of replacing the existing component with your own component is called an overlay another method is called extending an component where you define a sling:resourceSuperType which, if a resource is not found in the existing path, will pass the request to the superType to see if the resource can be found there.
Before 6.0 this concept of overlay applied only to resource. Which is a node that contains properties (simplistically speaking.) And in most common usage you have to reflect the majority of the component into the new search path to get what you are trying to do.
Starting in 6.0 there was a new concept of a merged resource. That would combine the values of a resource located in multiple search paths. This allowed you to modify or alter the functionality of a component without replicating everything else. You could just change a property at a particular level.
None of this happens automatically. To get this functionality the component needs to be aware of the ResourceMergerApi and use that API when attempting to resolve resources for it to use.
That's why the documentation mentions granite. Granite refers to the new components being written by Adobe that uses the TouchUI and is aware of this new API. With each new release more and more older components are being replaced by the new TouchUI based ones that supports resource merging. Including the carousel.

how properties are stored in /etc/designs for design dialog

I'm new to CQ5 and working on a project that deals with refactoring code that uses design dialogs.
Currently, I have a property declared as part of design dialog of my component. It creates a folder in /etc/designs/ for each template my component is used on. Is there a way we can make sure that those property values are stored at one particular configuration in /etc/design(as opposed to multiple)? I need to make sure only one set of configurations is used for all pages that use my component.
Thanks in advance!
Pallavi
The designs are linked to the template and not the whole site.
Hence whenever you configure the component in design mode, the values are stored within the corresponding template under the jcr:content of the configured design page or under /etc/designs/default/jcr:content in case no design is configured.
As far as I know, there is no way to tell AEM to store all the design configurations under one single path, unless you are using absolute paths in your dialog / page configurations.
If you are using multiple templates in your site, there must be one master template (which render global components eg. header/logo/navigation & footer), and all other templates should extend master template to get these global components and change pagelayout for content section.
Saying so, if templates are structured & inherited properly, you should be able to set design dialog property on home page (created using master template) and all internal pages will be able to access those design property OOB. Though child pages (created using other template) can override those design property (if needed for that template) to break inheritance.

How page activation take place for pages containing inherited component i.e components dropped in iparsys?

I have created a website structure in CQ5 WCM. I have created one template and defined few parsys and iparsys into its page level component. After this i have created one page and several more pages under it. Now my question is if make changes to the iparsys component and activate it, would all the pages inheriting it will also get activated or i need to activate all the pages individually?
Yes, all the nested pages would pick-up the change. Look at it as a "computed" reference - your page containing the original content gets replicated to the publish instance's repository, and all other pages compute their HTML based on that indirectly-referred content.
Dispatcher's cache however is another beast - make sure you're invalidating whole site's cache, rather than just the page you activated.