How to include clientlibs in you component using Sightly AEM/Adobe CQ/AEM6
How to use client libs in Sightly
First you should declare data-sly-use.clientlibInclude in your .html file
<div data-sly-use.clientlibInclude="${'/libs/granite/sightly/templates/clientlib.html'}"></div>
how to include only CSS of clientlib
<output data-sly-call="${clientlibInclude.css @ categories='clientlib1,clientlib2'}" data-sly-unwrap/>
how to include only JS of clientlib
<output data-sly-call="${clientlibInclude.js @ categories='clientlib1,clientlib2'}" data-sly-unwrap />
how to include both CSS and JS of clientlib
<output data-sly-call="${clientlibInclude.all @ categories='clientlib1,clientlib2'}" data-sly-unwrap />
Component not showing in Touch UI / SideKick of Classical UI in AEM / Adobe CQ5 / AEM6
To see component in the Touch UI
If you want to see the component in touch UI components list. The component Should have cq:editConfig nodeTo See Component in the SideKick in Classic UI
- The component should have dailog.
- if component have dialog and not showing in sidekick. Check title of Component it should starts with capital letter.
How to Install/Add Bundles, Content Packages or Configurations at Runtime CRX in AEM/Adobe CQ5
Install Bundles, Content Packages or Configurations at Runtime
If you want to install additional packages into the CRX , Create install folder under the crx-quickstart.Put your bundles, content packages or configurations in install folder. It will pick up while instance start and install into the CRX repository. Packages will install into CRX in the alphabetic order.
References :
AEM Documentation
Adobe Community
You can define additional bundles based on run modes
for this you need to create install.<run mode> folder.for more information click here
AEM6 /Adobe CQ5 How to Add and Read Bundle / Service Configurations(String, Dropdown, Array/Multifield )
Adding Properties to the Bundle/ OSGI CQ Service
String / TextField
@Property(value = "GET")
static final String STRING_VAL = "string.textfield";
String Array / Multifield
@Property ( unbounded=PropertyUnbounded.ARRAY, value={"*"},label="Template paths",description="eg: /apps/devtools/templates/page-home" )
private static final String MUTIFIELD_EX = "multifield.test";
Boolean Field
@Property(boolValue={false}, label="Boolean values", description="Booealn test")
private static final String BOOLEN_TEST = "boolean_test";
Dropdown
@Property( options={
@PropertyOption(name="blue", value="color-blue"),
@PropertyOption(name="green", value="color-green"),
@PropertyOption(name="red", value="color-red"),
@PropertyOption(name="yellow", value="color-yellow"),
private static final String SELECTION_TEST = "dropdown.test";
Reading Properties of Bundle/ OSGI CQ Service
1) You to get the ConfigurationAdmin reference
@Reference
ConfigurationAdmin configAdmin;
2) Get Bundle Configuratinn
Configuration config = configAdmin.getConfiguration(this.getClass().getCanonicalName());
3) Get properties of conguration
Dictionary<?, ?> configProperties = config.getProperties();
4) Red Properties
Reading String/TextField
String texfiledValue = (String) configProperties.get( STRING_VAL );
Reading the Dropdown
String dropdownTest = (String) configProperties.get( SELECTION_TEST );
Reading Boolean
Boolean booealnTest = ( Boolean ) configProperties.get( BOOLEN_TEST );
Reading Array/Multifield
String[] multifieldVlaues = (String[]) configProperties.get( MUTIFIELD_EX );
for( String value : multifieldVlaues ){
out.println( value );
}
Sitemaps for the Adobe CQ Site
Sitemaps for the Adobe CQ Site
Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL. We don’t need to submit each Sitemap individually. Just submit the Sitemap index file and you're good to go.
Creating and submitting a Sitemap helps make sure that search engine knows about all the pages on your site, including URLs that may not be discoverable by search engine normal crawling process.
The Sitemaps protocol enables you to let search engines know what content you would like indexed. To tell search engines the content you don't want indexed.
The Sitemaps protocol enables you to let search engines know what content you would like indexed. To tell search engines the content you don't want indexed.
Create sitemap index category page:
Create a page “sitemap-index-categories” in CQ. Under this page create category node with urls property. The category node name should be the page name that is under the root of your site.
Note: “/…” mean that all pages and subdirectories in that directory should be included in the referenced sitemap.
Sitemap index file generation:
Create a sitemap-index template and page component. Create xml.jsp under the sitemap index page component. Write the logic in the xml.jsp that will iterate over the category nodes which are created under the page “sitemap-index-categories” and generated the xml file in the below structure .
Sample sitemap index file
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap> <loc>http://<host>/<category-node-name>.xml</loc></sitemap>
<sitemap><loc>http://<host>/<category-node-name>..xml</loc></sitemap>
</sitemapindex>
Sitemap Generation
Create xml.jsp under the page component which would be the super type of all your templates, So that you can access in the every page in the site.
In the xml.jsp write a logic that will read the URl to get the “category-node-name”. Read the urls property of “category-node” and then generate the below xml structure. If the URL contains “/…” at the end you need to include all pages and subdirectories in that directory in the xml file.
Sample sitemap file:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <loc>http://<host>/about_us.html</loc></url>
<url> <loc http://<host>/about_us/<page-path>.html
</loc> </url>
</urlset >
Note: Create sitemap_index page using sitemap-index template under the root of your site. Access sitemap_index.xml from browser url to generate the sitemap index.
References:
How to setup Maven in your development environment
You can use Maven to build an OSGi bundle. Maven manages required JAR files that a Java project needs in its class path. Instead of searching the Internet trying to find and download third-party JAR files to include in your project’s class path, Maven manages these dependencies for you.
You can download Maven 3 from the following URL:
- Unzip the distribution archive, i.e. apache-maven-3.1.1-bin.zip to the directory you wish to install Maven 3.1.1. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.1.1 will be created from the archive
- Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.1.1. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven 2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character.
- In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
- Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.
- In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line.
- In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
- Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.
Create an Adobe CQ Maven archetype project
To create an Adobe CQ archetype project, perform these steps:
1. Open the command prompt and go to your working directory (D:\smaple-cq-project).
2. Run the following Maven command:
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
3. When prompted for additional information, specify these values:
groupId: com.test
artifactId: cq-test-project
version: 1.0-SNAPSHOT : 1.0.0
package: com.aem.coe
appsFolderName: AEM-Training
artifactName: AEM Training
packageGroup: AEM
confirm: Y
4. Once done, you will see a message like:
1. Open the command prompt and go to your working directory (D:\smaple-cq-project).
2. Run the following Maven command:
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
3. When prompted for additional information, specify these values:
groupId: com.test
artifactId: cq-test-project
version: 1.0-SNAPSHOT : 1.0.0
package: com.aem.coe
appsFolderName: AEM-Training
artifactName: AEM Training
packageGroup: AEM
confirm: Y
4. Once done, you will see a message like:
Subscribe to:
Posts (Atom)
-
OSGI configuration We all know every OSGI service/ component configurations meta data in OSGI Console, Configuration section or we can...
-
Open package manager http://localhost:5632/crx/packmgr/index.jsp Click on the crate packge Enter package name ,versi...
-
1 . Open the welcome screen.(http://localhost:7402/projects.html). 2. Click on the Tools. You will get below screen. ...
-
1) You need to get the editable of the component which you want to open dialog var cmpEditables = Granite.author.store.find("...
-
Copy the parsys component from(/libs/foundation/components/parsys) to your poroject(/apps/<project nmae>/components/). 2. I...
