Menu

How to get list of components in AEM?

We can get the list of components based on the project path or component group in AEM. SQL Query is powerful to filter out the component nodes and this can be easily used in the query tool of crx/de and export the results in a spreadsheet.

Below is the JCR-SQL2 query to get the list of all the components in AEM. 

SELECT * FROM [cq:Component] AS s WHERE [componentGroup] IS NOT NULL AND ISDESCENDANTNODE([/apps/aem-sample-project/components])

AEM query tool to run the SQL query to find and get nodes
AEM Query Tool

 

Failed to read artifact descriptor | Maven

Problem

Failed to read artifact descriptor for com.adobe.acs:acs-aem-commons-bundle:jar:3.17.2: could not find artifact com.adobe.acs:acs-aem-commons:pom:3.17.2 in central (https://repo.maven.apache.org/maven2)

Resolution

In case you are seeing this error while building the code using Maven then please try to run the maven command with -Padobe-public or setting ssl=true. Below are the sample command lines.

mvn -PautoInstallPackage -Padobe-public clean install

OR

mvn clean install -P autoInstallPackage -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

Hide and show AEM component using authoring

 Hi Friends, today in this article we are going to see an example of how we can hide and show the content of the AEM component using authoring.

First of all, we will add an isHide checkbox field in the component dialog so that an author can set it based on the requirement. Below is the code node structure of isHide node in the component dialog.

{
	jcr:primaryType: "nt:unstructured",
	uncheckedValue: "false",
	name: "./ishide",
	text: "Hide content",
	value: "true",
	sling:resourceType: "granite/ui/components/coral/foundation/form/checkbox",
	fieldDescription: "Hide the content of this component on page."
}

Since we have completed the dialog part now move to the component HTL page where we will manage the rendition.

<sly data-sly-use.objectJorvee="com.jorvee.aem.models.sample.custom.HideShow"></sly>
<sly data-sly-test="${!objectJorvee.isHide}">
	<div>rashidjorvee</div>
	<p>Some content here</p>
</sly

Once you will check the isHide option then after it will be difficult to find the component on the page, hence add the below line of code in the HTL file so that it will show a copy text to configure the component always in edit mode.


<div data-sly-test="${(wcmmode.edit)}"
     style="text-align: center; padding: 20px 0; width: 100%; text-decoration: underline; color: #00a8e1;"
     data-sly-unwrap="${wcmmode.disabled}">Configure your AEM component
</div>