AEM - Versioned clientlibs configuration conflict | Community
Skip to main content
Guglielmo_Francesconi
Level 2
November 12, 2021
Solved

AEM - Versioned clientlibs configuration conflict

  • November 12, 2021
  • 3 replies
  • 2638 views

I'm having a problem with two htmlwriter configurations: one for the versioned clientlibs and the other for link rewriting (removing /content/mysite from links). Only the configuration with the higher order is working, excluding the other one.

I've tried also combining them but it doesn't work for me, since the versioned clientlibs stopped working.

Is there a way to make two htmlwriter configurations work together ?

My merged configuration:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" jcr:primaryType="nt:unstructured" contentTypes="text/html" enabled="{Boolean}true" generatorType="htmlparser" order="5000" paths="/content/mysite" serializerType="htmlwriter" transformerTypes="[linktype,linkchecker,versioned-clientlibs]"> <generator-htmlparser jcr:primaryType="nt:unstructured" includeTags="[A,OPTION]"/> </jcr:root>

 

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 Guglielmo_Francesconi

Ok I managed to fix this after @asutosh_jena_ suggestions and after various trying. Final working configuration is this:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="nt:unstructured"
    contentTypes="[text/html]"
    enabled="{Boolean}true"
    generatorType="htmlparser"
    order="1001"
    paths="[/content/mysite]"
    serializerType="htmlwriter"
    transformerTypes="[linktype,versioned-clientlibs]">
    <generator-htmlparser
        jcr:primaryType="nt:unstructured"
        includeTags="[A,OPTION,LINK,SCRIPT]"/>
</jcr:root>

Versioned clientlibs was working only for css because the SCRIPT options was missing from includeTags property.

Thank you @asutosh_jena_ for the tips.

3 replies

Asutosh_Jena_
Community Advisor
Community Advisor
November 13, 2021

Hi @guglielmo_francesconi 

 

You can configure the rewriter in the below format and it will work for both versioned clientlib as well as link rewriter.

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
contentTypes="[text/html]"
enabled="{Boolean}true"
generatorType="htmlparser"
order="1"
serializerType="htmlwriter"
transformerTypes="[linkchecker,versioned-clientlibs,resourceresolver-map]">
<generator-htmlparser
jcr:primaryType="nt:unstructured"
component-optional="{Boolean}true"
includeTags="[A,/A,IMG,SOURCE,/SOURCE,LINK,SCRIPT,FORM]"/>
</jcr:root>

 

Thanks! 

Guglielmo_Francesconi
Level 2
November 15, 2021

Hi @asutosh_jena_ ,

 

I've tried doing as you told, also removing the property "paths" which I need because I have multiple sites on the same instance, but it's working only the "versioned clientlibs" part, excluding link rewriting.

Asutosh_Jena_
Community Advisor
Community Advisor
November 15, 2021

Hi @guglielmo_francesconi 

 

Please make sure the below config node has the below property.

 

com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory.xml

 

<?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"
jcr:primaryType="sling:OsgiConfig"
linkcheckertransformer.disableChecking="{Boolean}true"/>

 

What's the rule that you are applying on /etc/maps for shortening the URL?

Guglielmo_Francesconi
Guglielmo_FrancesconiAuthorAccepted solution
Level 2
November 15, 2021

Ok I managed to fix this after @asutosh_jena_ suggestions and after various trying. Final working configuration is this:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
    jcr:primaryType="nt:unstructured"
    contentTypes="[text/html]"
    enabled="{Boolean}true"
    generatorType="htmlparser"
    order="1001"
    paths="[/content/mysite]"
    serializerType="htmlwriter"
    transformerTypes="[linktype,versioned-clientlibs]">
    <generator-htmlparser
        jcr:primaryType="nt:unstructured"
        includeTags="[A,OPTION,LINK,SCRIPT]"/>
</jcr:root>

Versioned clientlibs was working only for css because the SCRIPT options was missing from includeTags property.

Thank you @asutosh_jena_ for the tips.

Adobe Employee
June 2, 2023

Any one facing this issue- Please note that the order parameter plays a critical role in situation where server has multiple versioned-clientlibs configurations with same name.

So the simple solution is to rename your config: versioned-clientlibs ---> versioned-clientlibs-custom1. That's it.

Few other things to consider: Just ensure 2 things to make it perfect:

1. paths- Try to make it precise to cover all content root where you want versioning e.g. /content

2. order- make sure your config order has higher number to other versioned-clientlibs configurations

I was having the same where things were working fine in local but not on server because it has multiple versioned-clientlibs configurations. After increasing order value -versioning started working fine on the server.