Modify the OOTB LinkChecker Config

I've come into the issue recently of needing to modify the prefix and suffix for invalid links detected by the linkchecker. This seemingly simple task is unfortunately not as easy as overlaying the /libs/cq/linkchecker/config.author/invalid to /apps/cq/linkchecker/config.author/invalid. For reasons unknown (to me at least) the standard overlay does not work for this type of update. Instead, after digging into the code, I found this information: REQUEST_ATTRIBUTE_NAME = LinkCheckerSettings.class.getName(); LinkCheckerSettings settings = (LinkCheckerSettings)request.getAttribute(REQUEST_ATTRIBUTE_NAME); The above lines indicate...

Hide/Show parsys on the fly with JavaScript

It is relatively painful to deal with tabs, accordion, or carousel component. Especially when we want to enhance content author experience. Here’s a use case to illustrate to you what I meant: We need to build a tabs component. We want author to manage tabs’ content on the page (not via child page or a separate page). We want author to drag and drop any component into any tab’s content they wish. Bug The screenshots...

CQ Dialog - Generate dynamic rootPath with ExtJS Plugin

This article will shows you how to: one write ExtJS plugin and calls it in CQ dialog and two generating rootPath with ExtJS plugin. We know that with xtype pathfield, we can set rootPath value to any location we want. The drawback is that it is static. If we set rootPath to /content, we fall into providing “no so good author experience” as content author needs to click through pages list to get to the...

How to Manage Field Dependencies in a CQ Dialog

I'm working on a front-end project with some relatively complex UI requirements for author dialog. The author UI requires field dependency. A set of fields is shown or hidden based on a certain selection author makes. After getting a working codes finalized, I thought that it is worth sharing with the community. Sample use case for field dependency: As a content author, I would like to be able to build a grid of maximum 12...

How NOT to Generate HTML

Recently, I have been working on an integeration between Adobe's Search and Promote and CQ5/AEM.  This work has reminded me of one of my least favorite anti-patterns, embedding HTML markup in Java code.  You tend to see this 'technique' a lot in Servlets, Tags and other Java web technologies.  This is a bad idea for several reasons: It breaks the MVC model It's hard to understand the HTML code It's difficult, if not impossible, to modify the...

Expression Language, Tags and You

One of the things I’ve seen on many projects which makes code a lot more difficult to read and understand is scriptlet (aka Java inside JSPs). Especially now, there really isn’t a good reason you need to ever use scriptlet inside your JSPs, but especially given the prevalence within CQ’s codebase it’s a common practice. Helpful tools Recently, myself and others have been contributing code to make it easier to develop JSPs in CQ without...

Creating and Configuring your Maven Project for AEM

The goal of this document is to have a maven project that builds a single asset (the package profile) to deploy all Servlets, Services, and JCR Code. In addition to this, for development purposes we want to be able to build each item listed above individually, such that we do not require a full build to test a simple JSP change. For starters, this is a fairly common project structure that we'll be basing this...

The Great and Powerful cq:EditConfig

One of the most under-appreciated features of AEM components, in my opinion, is the cq:EditConfig. This node allows developers to configure how a component is edited, add or remove functionality from the editor and generally tailor the authoring experience for component. The cq:EditConfig is simply a node with the primary type cq:EditConfig and the name cq:editConfig under the component root. The cq:EditConfig allows for configuring many important features of the component’s editing experience including: Dialog...

AEM Start/Stop Script Modification for a Cluster

When clustering AEM instances there is a required order for shutting down and starting the instances. This however can be very tricky in a shared nothing cluster as the master & slave can automatically swap places at any time for multiple reasons. This means in order to shut down an instance you typically need to identify the master instance first. Conversely in starting up an instance the slave can only be started after the master...

AEM Restricted Backup User

The AEM backup curl command is often passed using admin credentials however for security reasons it may be undesirable to store the AEM admin user’s credentials in plaintext form in a system script. To mitigate this instead a generic user can be created and be granted more specific access rights to the granite backup console. This will allow to restrict what this user has the ability to do by only having granted rights to start,...