Expand my Community achievements bar.

SOLVED

Custom transformer for exporting Experience Fragments to Target

Avatar

Level 3

We are considering using Target's Visual Composer with Experience Fragments exported from AEM. We also have a custom transformer Java class (extending com.adobe.acs.commons.rewriter.ContentHandlerBasedTransformer) used for some of our components' content, and those components may be included in exported fragments if we start using them.

It looks like, when a fragment is exported, the transformer is not applied. Also, another processing seems to be applied, and most likely it's jsoup-html-generator configured in /libs/experience-fragments/config/rewriter/experiencefragments node, so perhaps this configuration can be overlayed.

How exactly can we overlay this configuration so that our custom processor is invoked before or instead this preconfigured one?

Our current AEM version is 6.5.8 and we are working on upgrading to 6.5.11.

1 Accepted Solution

Avatar

Correct answer by
Level 3

I have managed to resolve this. In case anyone is interested, here is how it can be done:

  1. You should have a rewriter configuration in /apps/{your-site}/config/rewriter/{your-rewriter}
  2. The node's "transformerTypes" property should contain pipeline type from the configuration of the TransformerFactory that produces the transformer.
  3. The node's "resourceTypes" property should contain the resource type(s) of the Experience fragmet variations you need to export.

More information on configuring rewriters:

https://wcm.io/handler/url/rewriter.html

https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter....

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

I have managed to resolve this. In case anyone is interested, here is how it can be done:

  1. You should have a rewriter configuration in /apps/{your-site}/config/rewriter/{your-rewriter}
  2. The node's "transformerTypes" property should contain pipeline type from the configuration of the TransformerFactory that produces the transformer.
  3. The node's "resourceTypes" property should contain the resource type(s) of the Experience fragmet variations you need to export.

More information on configuring rewriters:

https://wcm.io/handler/url/rewriter.html

https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter....