Tuesday 10 June 2014

Navigation API's, Client Library: in AEM CQ

Navigation:Creates a new navigation object.
Navigation API's:
getAbsoluteParent(2)- to get parent page
listChildren- list all children
Pagefilter- to exclude all invalid pages (pages hidden from navigation)

Below given sample code shows how a navigation element can be created.

navigation component.

navigation component

%><%@include file="/libs/foundation/global.jsp"%><%
<%@ page import="java.util.Iterator,
org.apache.commons.lang.StringEscapeUtils" %>
<%@page session="false" %><%
            // TODO add you code here


    Page navRootPage = currentPage.getAbsoluteParent(2);

if(navRootPage != null){
Iterator<Page> children = navRootPage.listChildren(new PageFilter(request));
    Page child = children.next();
<a href="<%=child.getPath()%>.html">
<%= StringEscapeUtils.escapeXML(child.getTitle())%>



Client Library:cq:ClientLibraryFolder
The Client Library (ClientLib) in Adobe AEM makes it easy to include client libraries(files like js or css) by category and each can be accessed through dependencies.
It can be created under etc>clientlibs or design/project folder.

Read More: 
Solr and AEM
JSON for Solr
Search Persistance
Navigation in AEM

Website design steps in AEM

No comments:

Post a Comment