Custom transformer for exporting Experience Fragments to Target | Community
Skip to main content
Level 2
December 20, 2021
Solved

Custom transformer for exporting Experience Fragments to Target

  • December 20, 2021
  • 1 reply
  • 1360 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Alexander_Prikhodko

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.html

1 reply

Alexander_PrikhodkoAuthorAccepted solution
Level 2
December 20, 2021

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.html