Some more useful snippets for AEM. Please create an issue if you have any comments or would like to add some more useful snippets etc.
- Remove
#cf/
- Don’t want to see/wait for the content-finder while refereshing pages, just remove #cf/ in your url. ?debug=layout
- Shows you all details of the components used on your page?debugConsole=true
- Runs Firebug Lite inside your browser?wcmmode=(edit|preview|design|disabled)
- This parameter sets your WcmMode in the specified mode, makes testing for a particular WcmMode easier .?debugClientLibs=true
- Writes out all Clientlib categories as separate files (check your HTML-source).CTRL+SHIFT+U
- In combination with ?debugClientLibs=true will show you timing information of your page
- create folder
clientlibs
with these properties (.content.xml
):
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
dependencies=""
categories=""
embed=""/>
categories
will be the identifier to this clientlib- create
css.txt
andjs.txt
- use
#base=css/
in the first line of these files to define a base path for file inclusion - inlude clientlib with this in your jsp files:
<cq:includeClientLib categories="" />
How to disable the link checker for specific links:
<a x-cq-linkchecker="valid" ...
<a x-cq-linkchecker="skip" ...
Order of evaluation:
- cq:allowedTemplates
- allowedPaths (deprecated)
- allowedParents
- allowedChildren
[(Source)](http://docs.adobe.com/docs/en/cq/current/developing/templates.html#Template Availability)
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
cq:actions="[text:Inherited Configurations from Base Framework]"
cq:dialogMode="floating"
cq:layout="editbar"
cq:emptyText="Defines text that is displayed when no visual content is present."
jcr:primaryType="cq:EditConfig">
<cq:listeners
jcr:primaryType="cq:EditListenersConfig"
afteredit="REFRESH_PAGE"
afterinsert="REFRESH_PAGE"/>
</jcr:root>
- actions: (text: | - | edit | delete | insert | copymove)
- dialogMode: (floating | inline | auto)
- layout: (rollover | editbar | auto)
(See here for more details on the [EditConfig](http://dev.day.com/docs/en/cq/current/developing/components.html#Configuring with cq:EditConfig Properties) and listener properties.)
java -XX:MaxPermSize=256m -Xmx1024M -jar cq-quickstart-6.0.0.jar
crx-quickstart/bin/(stop | start | status | quickstart)
Installation run modes (not changeable): author, publish, samplecontent, nosamplecontent
cq-<instance-type>-p<port-number>.jar
cq-publish-p4503.jar
Additional run modes:
- crx-quickstart/conf/sling.properties:
sling.run.modes=author
java -jar cq-56-p4545.jar -r dev
- System property:
-Dsling.run.modes=publish,prod
Check current run modes of your instance:
- Go to your Felix console (/system/console).
- Click on “Sling Settings” (/system/console/status-slingsettings)
Possible memory leaks? -XX:+HeapDumpOnOutOfMemoryError
Start in debug mode: help article
-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
Example:
java -Xmx512m -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar cq-author-4502.jar
OR:
crx-quickstart/bin/start -d --debug-port 8000
Checkout:
vlt --credentials admin:admin co http://localhost:4502/crx/-/etc/designs ~/Desktop/
Export code from JCR:
vlt export -v http://localhost:4502/crx /content/forms forms
Import code to JCR:
vlt -v import http://localhost:4502/crx . /
See modified files:
vlt st
See changes:
vlt diff text.jsp
Commit changes:
vlt ci test.jsp
There are three Mode available:
- replace: Normal behavior. Existing content is replaced completly by the imported content, i.e. is overridden or deleted accordingly.
- merge: Existing content is not modified, i.e. only new content is added and none is deleted or modified
- update: Existing content is only updated but never deleted
(via wemblog)
- Data First, Structure Later. Maybe.
- Drive the content hierarchy, don't let it happen.
- Workspaces are for clone(), merge() and update().
- Beware of Same Name Siblings.
- References considered harmful.
- Files are Files are Files.
- ID's are evil.
GET Request: [...]/print.a4.html (Resource type of this resource is is "sling\sample")
Matches in order:
- print/a4.html.jsp
- print/a4.jsp (matches more selectors, html extension is implied)
- print.html.jsp
- print.jsp
- html.jsp
- sample.jsp
- GET.jsp
Wrong: a4.html.jsp - does not include the first selector (print) a4/print.html.jsp - wrong order of selectors
(Source, also see [here] (http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java) for some example tests)
sling:hideProperties (String or String[])
Specifies the property, or list of properties, to hide.
The wildcard * hides all.
sling:hideResource (Boolean)
Indicates whether the resources should be completely hidden, including its children.
sling:hideChildren (String or String[])
Contains the child node, or list of child nodes, to hide. The properties of the node will be maintained.
The wildcard * hides all.
sling:orderBefore (String)
Contains the name of the sibling node that the current node should be positioned in front of.
(Source)
cq:showOnCreate="{Boolean}true"
Page property to be available in the create view (e.g. Create Page wizard)
cq:hideOnEdit
Page property to be available in the edit view (e.g. View/Edit) Properties option)
renderReadOnly="{Boolean}true"
If this is not set it will show the form fields even if the author is not in edit mode.
(Source)
allowBulkEdit="{Boolean}true"
(Source)