Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

AEM - Versioned clientlibs configuration conflict

Avatar

Level 2

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>

 

1 Accepted Solution

Avatar

Correct answer by
Level 2

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.

View solution in original post

6 Replies

Avatar

Community Advisor

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! 

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.

Avatar

Community Advisor

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?

The "disableChecking" was already at true, but after some tests with the configurations I've managed to make the rewriter work with also the versioned-clientlibs.

The configuration is the following:

   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]"/>

linktype is the identifier for my custom java Transformer factory, used to modify the links inside the website. /etc/maps is not being used.

The only problem right now is that the versioned clientlibs is being applied only for css, and not for js. I'm using acs commons latest version: 5.0.14

clientlibs.JPG

 

 

 

Avatar

Correct answer by
Level 2

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.

Avatar

Employee Advisor

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.