Custom namespaces

Learn how to define and deploy custom namespaces to AEM as a Cloud Service.

Custom namespaces are the optional part of a JCR property preceding a :. AEM uses several namespaces such as:

  • jcr for JCR system properties
  • cq for AEM (formerly known as Adobe CQ) properties
  • dam for AEM properties specific to DAM assets
  • dc for Dublin Core properties

… and many others.

Namespaces can be used to denote the scope and intent of a property. Creating a custom namespace, often your company name, helps clearly identify nodes or properties specific to your AEM implementation and contain data specific to your business.

Custom namespaces are managed in Sling Repository Initialization (repoinit) scripts, and deploys to AEM as a Cloud Service as OSGi configurations - and added to your AEM project’s ui.config project.

Resources

Code

The following code is used to configure a wknd namespace.

RepositoryInitializer OSGi configuration

/ui.config/src/main/content/jcr_root/apps/wknd-examples/osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer~wknd-examples-namespaces.cfg.json

{

    "scripts": [
        "register namespace (wknd) https://site.wknd/1.0"
    ]
}

This allows custom properties using the wknd namespace, as denoted as the first parameter after the register namespace instruction, to be use in AEM. For more advanced script definitions, review the examples in the Sling Repository Initialization (repoinit) documentation.

On this page