Showing posts with label client library. Show all posts
Showing posts with label client library. Show all posts

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,
com.day.text.Text,
com.day.cq.wcm.api.PageFilter,
com.day.cq.wcm.api.Page,
com.day.cq.commons.Doctype,
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));
    %><ul><%
while(children.hasNext()){
    Page child = children.next();
    %>
<li>
<a href="<%=child.getPath()%>.html">
<%= StringEscapeUtils.escapeXML(child.getTitle())%>
</a>

</li>
<%
}
    %></ul><%

}
%>



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
AEM INTERNALIZATION
Search Persistance
Navigation in AEM

Website design steps in AEM