CQ5.6 : Can we have more than one Link Rewriter Transformer | Community
Skip to main content
Level 3
October 16, 2015
Solved

CQ5.6 : Can we have more than one Link Rewriter Transformer

  • October 16, 2015
  • 4 replies
  • 1679 views

 In our current CQ5.6 implementation, we have implemented one global link rewriter transformer which appends cdn urls for cq5 clientlibs. We are in process of creating one more site in same cq instance which will have different akamai url. My question is can we implement two link rewriter transformers which will append different akamai urls based on from which site it is called.

 

Regards,

Mayank

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 JustinEd3

Hi,

Yes, this is possible, but not with the way that you've implemented your transformer. The correct way to handle this is to have a named (not global) transformer and then to have multiple pipeline configurations, each with a different value for the paths property (see http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html for the complete list of properties you can set on a pipeline configuration node).

The problem with global transformers is that you can't do this kind of fine-grained configuration. Also, you can't properly order them. Which doesn't matter for some transformers, but is of great significance for others.

Regards,

Justin

4 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

Yes, this is possible, but not with the way that you've implemented your transformer. The correct way to handle this is to have a named (not global) transformer and then to have multiple pipeline configurations, each with a different value for the paths property (see http://sling.apache.org/site/output-rewriting-pipelines-orgapacheslingrewriter.html for the complete list of properties you can set on a pipeline configuration node).

The problem with global transformers is that you can't do this kind of fine-grained configuration. Also, you can't properly order them. Which doesn't matter for some transformers, but is of great significance for others.

Regards,

Justin

Level 3
October 16, 2015

Hi Justin,

Thanks for your reply, i followed the link mentioned in your post and i did following modifications:

1. Disabled Global rewriter.

2. Copied /libs/cq/config/rewriter/default to /apps/<myproject>/config/rewriter/default and modified transformerTypes property to "testTransformer" and added paths property with value "/content/myproject/*". Created unstructured node under it with name "transformer-testTransformer"

3. Created a service which implements Transformer and TransformerFactory with "pipeline.type"="testTransformer"

4. Deployed above changes and went to url /content/myproject/home.html but LinkTransformerService i created in step #3 was not invoked :(..

Can you please point out which step is incorrect? Thanks in advance for your help.

Adobe Employee
October 16, 2015

Hi,

That looks correct. Can you look at the Sling Rewriter status printer in the web console (http://localhost:4502/system/console/status-slingrewriter) and see if it is correctly reflecting your changes? You might also want to try restarting the Sling Rewriter bundle.

Regards,

Justin

Level 3
October 16, 2015

Hi Justin,

Was able to resolve the issue, in addition to adove changes, i made following modifications to make it work:

1. Instead of creating a "default" node under /config/rewriter, i created a node "testTransformer" (i.e. value of pipeline.type property) and removed child node "transformer-testTransformer".

2. Changed paths property value from "/content/<myproject>/*" to "/content/myproject/" and order from "-1" to "1"

Also, i enabled global link transformer and it seems my pipeline configuration works fine for all the paths configured in paths property and global transformer runs for all other paths just fine.

Does the above configuration including global transformer as well as pipeline specific transformer correct approach? 

Thanks for your help and guidance.

Regards,

Mayank