Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

3 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! 

Avatar

Level 2

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?

Avatar

Level 2

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.