Hi All,
I tried to do clientlibs versioning in AEM 6.1 by creating rewriter sling-folder and copying the 'default' node from libs > cq > config > rewriter. But its not working and the whole AEM local instance in getting corrupted. Error log is showing "Unable to get component of class 'interface org.apache.sling.rewriter.Transformer' with type 'versioned-clientlibs'."
Tried from the link http://www.aemcq5tutorials.com/tutorials/versioned-clientlibs-aem/
Any kind of help would be appreciated.
Regards,
Abhijit Chowdhury
Views
Replies
Total Likes
You should have ACS AEM Commons installed to make this work.
Views
Replies
Total Likes
ACS AEM Commons is already installed. Still it is not working.
Views
Replies
Total Likes
If you follow Versioned ClientLibs, then this is all you need. No need for "default" node under rewriter as you mentioned.
/apps/<myapp>/config/rewriter/versioned-clientlibs.xml
The easiest way to configure the rewriter pipline is just to copy /libs/cq/config/rewriter/default
to a path inside your application, e.g. /apps/myapp/config/rewriter/versioned-clientlibs
. Note that the configuration node must be inside a four-level path that ends in config/rewriter
Views
Replies
Total Likes
I have done all the steps with changes and now the instance is up & running. But the issue is, versioning is not reflecting in local AEM instance. Its all the same js & css files without query parameters.
Views
Replies
Total Likes
Could you share the configuration screenshot the way I shared above?
In addition to that, how did you test, could you share a screenshot for the same?
Views
Replies
Total Likes
Below is the screenshot of the configuration done
I ran a page from AEM, checked the source code. The js file should be appended with a query parameter, which is not getting done.
Please note, All the bundles are active, and Enforce MD5 is checked in Versioned Clientlibs Transformer Factory.
Views
Replies
Total Likes
What works for me in my local is jcr:primaryType="sling:Folder"
The same config is mentioned @ Versioned ClientLibs
<?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:Folder"
contentTypes="[text/html]"
enabled="{Boolean}true"
generatorType="htmlparser"
order="{Long}1"
serializerType="htmlwriter"
transformerTypes="[linkchecker,versioned-clientlibs]"/>
I've not enforced MD5 in my local and it works fine. Per docs
-
Optionally, a filter can registered which checks incoming requests for client libraries and ensures that the hash in the path is the correct value
Views
Replies
Total Likes
Thanks. But in libs > cq > config > rewriter, the default node is nt:unstructured. So when I copied, it became nt:unstructured. If manually I create the default node by choosing jcr:primaryType as sling:Folder then it appears as a folder and NOT as a node.
I am using AEM 6.1.
Views
Replies
Total Likes
I've tested it on 6.1 & 6.4 with sling:Folder and it worked fine.
This feature is agnostic of AEM version. Iconography doesn't matter, you could still configure the properties on that sling:Folder and test.
Views
Replies
Total Likes
Thanks Gaurav. I again tried with sling:Folder. But versioning is not getting reflected. Can you please guide how to check in local whether versioning is working. What I have tried is run a page from content folder, then checked the source code whether any query parameter is appended with the js file.
Views
Replies
Total Likes
why should the node be in 4 level path. In my case its 5 level down as per site structure. What should I do in that case? @Jörg_Hoh @smacdonald2008
Views
Replies
Total Likes
YOu can comment at that URL too for questions why its not working.
Views
Replies
Total Likes
Hi
I am on AEM 6.4 too. For me it is even stranger... I seems to work with a node of type nt:unstructured, but only on AUTHOR instance with a url which contains the /editor.html/ for triggering the authoring widgets in it. If I leave out the /editor.html, the md5 hashes disappear from all the clientlib references in the HTML markup.
On PUBLISH the feature doesn't seem to be active either (due to not using editor.html in the url?)
I have no idea why this is happening. Any hints?
Views
Replies
Total Likes
Probably, it is enabled/tied to runmode configuration
Check if you have "config.author" or similar rather than "config" folder in your setup: /apps/myapp/config/rewriter/versioned-clientlibs.xml
Views
Replies
Total Likes
Sorry, no not at all. As you normally want this feature active in all runmodes (author and publish) this shouldn't be in a runmode specific folder in my opinion. Even if it was, I stated that it works and doesn't work with 2 urls patterns on AUTHOR.
I think I fixed it though. In our project we had another rewriter configuration active next to the 'versioned-clientlibs' node. It had a 'Paths' property value of '/content/...' in it. So I figured, what if that one is overwriting the result of my versioned-clientlibs? If you add the '/editor.html' I assume this no longer matches that path and that second one isn't applied?
The second on had order '10', while my versioned-clientlib config had order '1'. So I figured to see what happens if I reverse the order, so I set the order value on versioned-clientlibs to '11' and making sure it was of type {Long}. And voila, problem disappeared!
So please guys look at http://localhost:4502/system/console/status-slingrewriter and check the order value of your config.
I assume similar rewriters for the [text/html] content type have Paths, Selectors or Resource Types defined so they don't conflict with your config. If you find one with a similar setup, just try to give the 'versioned-clientlibs' a higher order value to see it is applied last.
Hope it works for you guys too! Cheers!
Views
Replies
Total Likes
Good to know that it worked for you, however, I don't see any URI/URL path in this configuration. Its only resource path or resource type. "/editor.html" is not a part of any resource path but url path, that explains why it was broken.
Yes, order/rank would matter.
Views
Replies
Total Likes
I stated in my post "in our project" so ofcourse there is no path in this configuration. The screenshots above are not related to my project and the url I posted points to your own running AEM instance?
Furthermore I believe that the screenshots with the black rectangles is flawed in a sense that it also mentions content types text/javascript and text/css? In my understanding you want to rewrite links inside a text/html response which point to a clientlib. So I don't understand why you would need to mention the other resource types. The ACS Commons feature mentions that it doesn't work for references inside javascript or css files I believe. I guess it doesn't break anything, but as I am getting such nice feedback here I wanted to bounce my idea so hopefully someone can confirm or reject it.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies