Hi Everyone,
I have added sling mappings to shorten urls for content pages and for the assets under dam, the mapping rules are working fine and i am able to validate on tool http://localhost:4503/system/console/jcrresolver. but when i am trying to validate the rule on component the mapping is not working for most of the custom element:attribute entries added within link checker transformer config.
linkcheckertransformer.rewriteElements=["div:data-asset","div:some-attr","a:cust-attr","a:cust-attr2","a:href","area:href","form:action","img:src","img:srctest","link:href","script:src","img:testit","p:testit"]
Solved! Go to Solution.
Views
Replies
Total Likes
@nikeshpshindhe : You can also check the below 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="1"
serializerType="htmlwriter"
transformerTypes="[linkchecker,versioned-clientlibs,custom]"/>
Here is the path for the above config. Please see the below snapshot for the reference.
Thank You.
Keshav
Hi @nikeshpshindhe!
Shortening URLs consists of two different mechnisms:
1. The first part is responsible to make sure that a request to yourdomain.com/home.html will be mapped to the correct resource path on AEM side, e.g. /content/mytenant/us/en/home. Depending on your specific requirements and setup, this can be handled on AEM side (Sling Mappings) or on web server level (mod_rewrite).
2. The second part is responsible to adjust all links, references, etc. in the generated, outgoing HTML source code. The rewriting makes sure, that your links are pointing to the shortened URL (e.g. /home.html) instead of the full resource path (e. g. /content/mytenant/us/en/home.html).
From your explanation I understand that mapping (1) seems to work as expected but rewriting (2) has issues with custom tags and/or attributes.
There are a couple of things that you can check:
Hope that helps!
Hi Markus, Thanks for looking into this post.
Views
Replies
Total Likes
Views
Replies
Total Likes
@nikeshpshindhe , Have you added the link-checker config service under the configuration. If yes you can compare with below things and if not then you can check and add the same.
I have added this link check in AEM 6.4 as per the below.
Step 1 : created the com.day.cq.rewriter.linkchecker.impl.LinkCheckerImpl.xml configuration under the config parallel to the components folder.
Step2 : content of the file: Just check custom attributes for the reference.
<?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"
service.check_override_patterns="[^system/.]"
service.special_link_prefix="[javascript:,data:,mailto:,#,<!--,${,http://,https://,tel:]"/>
Thank You.
Keshav
@nikeshpshindhe : You can also check the below 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="1"
serializerType="htmlwriter"
transformerTypes="[linkchecker,versioned-clientlibs,custom]"/>
Here is the path for the above config. Please see the below snapshot for the reference.
Thank You.
Keshav
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi @nikeshpshindhe Is this worked for you? currently I am working in cloud version, for me also whatever I have added after script:src (upto this OOTB entry) as a custom entries in rewriter elements it's not working.
Can anyone help me on this?
CC: @kchaurasiya can you help me on this again?
Views
Replies
Total Likes
@AJITH_LALR You can map the links using resolver.map(resourcePath) method and append the same to your custom attributes
Views
Replies
Total Likes
Views
Likes
Replies