Hello All - Is there a way to configure the externalizer for multiple publish domains? We have 4 domains in our project and would like to maintain the externalizer config based on run-modes. In the externalizer config it says, we need to specify publish followed by domain to specify the configs. i.e
How can I specify the configs. Since all are different domains.
Have you explored context-aware configuration for your problem? I believe you should be able to create separate configs for different paths of your repository.
You can define it in the OOTB configuration.i.e., with com.day.cq.commons.impl.ExternalizerImpl.xml and add the domain names. In your code you can read the configuration by passing the domain name.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
externalizer.domains="[author http://localhost:4502,publish http://localhost:4503,website1 https://www.website1.com,website2 https://www.website2.com]"/>
This Doesn't actually work, not sure if there is any other customization needed on AEM on cloud.
@aemninja Once you define various domains in externalizer, you would be able to refer those in the code as below:
String myExternalizedUrl = externalizer.externalLink(resolver, Externalizer.LOCAL, "/my/page") + ".html";
Do we need to add this logic to very component?