I raised this on Stack Overflow about 10 months ago, but never got anywhere. We are now fighting this again:
http://stackoverflow.com/questions/26220078/sling-mapping-rewrite-rules-do-not-rewrite-jcrcontent-pa...
Using AEM 5.6.1.
I have sling mappings that rewrite outgoing paths to the external URL. An example of this rewrite: /content/www-sitename/home.html would be rewritten to http://www.sitename.com/home.html
Some HTML on a page component:
<head> <meta property="og:url" content="/content/www-sitename/test.html" /> <meta property="og:image" content="/content/www-sitename/test/_jcr_content/metaTag4/image.img.png/1410810317565.png" /> <meta name="twitter:card:image" content="/content/www-sitename/test/jcr:content/metaTag4/image.img.png/1410810317565.png" /> </head>
When visited, only the og:url
meta tag has been rewritten, the others are unchanged:
<head> <meta property="og:url" content="http://www.sitename.com/test.html" /> <meta property="og:image" content="/content/www-sitename/test/_jcr_content/metaTag4/image.img.png/1410810317565.png" /> <meta name="twitter:card:image" content="/content/www-sitename/test/jcr:content/metaTag4/image.img.png/1410810317565.png" /> </head>
Both linkcheckertransformer.rewriteElements
and htmlgenerator.includeTags
have been configured to include meta tags for Sling rewriting. Why does this work for non-jcr:content
links, but not those that include jcr:content
or _jcr_content
? Aside from creating a custom rewrite filter, what can be done to get the jcr:content
URLs to be rewritten?
This isn't specific to the meta tags. Examining the images on the page, we also find that all the image src values (which are references to the image components; ie, /content/www-sitename/test/_jcr_content/par/image4.img.png/1410810317669.png) also remain unmapped. Strangely, using the JCR Resource Resolver in the OSGi Console, the path gets correctly mapped: /system/console/jcrresolver?msg=http%3A%2F%2Fwww.sitename.com%2Ftest%2F_jcr_content%2FmetaTag2%2Fimage.img.jpg%2F1440086345066.jpg&test=%2Fcontent%2Fwww-sitename%2Ftest%2Fjcr%3Acontent%2FmetaTag2%2Fimage.img.jpg%2F1440086345066.jpg
LinkCheckerTransformerFactory
includes the option for Strict Extension Check
. The description of this setting seems to imply the behaviour that I am seeing. It is, however, set to false. I tried setting it to true, and all URLs (including those ending with .html) stopped being rewritten.Is there something that can be done to force mapping the jcr:content paths?
Solved! Go to Solution.
Views
Replies
Total Likes
The following page answers your query above - http://www.cqblueprints.com/tipsandtricks/serving-static-assets-alt-url.html. The default rewriter in CQ only rewrites URIs with HTML extensions.
Views
Replies
Total Likes
The following page answers your query above - http://www.cqblueprints.com/tipsandtricks/serving-static-assets-alt-url.html. The default rewriter in CQ only rewrites URIs with HTML extensions.
Views
Replies
Total Likes
Thank you, kunal.
Views
Replies
Total Likes
Views
Likes
Replies