We're experiencing some inconsistency with URLs on our publish instance. Some links are having the /content/project/ removed whilst others are not.
The /etc/map has been created and seems to be working as expected, except for these links.
An example of where the rewriting is links in the OOTB Text component. Just highlighted the text and used the hyperlink in the RTE. The output HTML on publish comes through as the desired
<a adhocenable="false" href="https://forums.adobe.com/path/support.html">My Link</a>
A link that's not being rewritten is from a component, in it's dialog we have a richtext xtype that is referenced in the jsp
<cq:text property="description">
This however is output on the publish as:
<a adhocenable="false" href="https://forums.adobe.com/content/project/path/support.html">Other Link</a>
I've had a look in /system/console/configMgr and the Day CQ Link Transformer Checker and this has a:href, area:href, from:action, input:value. So I thought this would pick up the links under anchors.
If anyone can suggest where I should be looking to resolve this, any help would be appreciated.
Solved! Go to Solution.
Views
Replies
Total Likes
It should work because rewriter called after html is generated. Just that your custom implementation causing not closing tags properly causing the issue. Here are the steps to debug
1) Access components directly <path of component>.html ex:- /content/geometrixx/en/jcr:content/par/text_1.html
2) Verify it is well formed and is closing all html tags properly.
3) If no issue in step2. Tail error.log and request for "<path of component>.html" see if there is xss warning.
4) If no issue in step3 in component where ever you have href written add additional attribute x-cq-linkchecker= skip and update the forum with output of "<path of component>.html"
OR
1) Disable link checker, After the change all rewrite does not happen.
2) Access the page & go to view source of page
3) Verify it is well formed and links in valid url in terms of syntax also.
You can define your own Link Rewritter service too using AEM Java APIs. For details:
http://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html
You may also want to check this KB:
http://helpx.adobe.com/experience-manager/kb/HowToConfigureLinkRewriting.html
Views
Replies
Total Likes
It should work because rewriter called after html is generated. Just that your custom implementation causing not closing tags properly causing the issue. Here are the steps to debug
1) Access components directly <path of component>.html ex:- /content/geometrixx/en/jcr:content/par/text_1.html
2) Verify it is well formed and is closing all html tags properly.
3) If no issue in step2. Tail error.log and request for "<path of component>.html" see if there is xss warning.
4) If no issue in step3 in component where ever you have href written add additional attribute x-cq-linkchecker= skip and update the forum with output of "<path of component>.html"
OR
1) Disable link checker, After the change all rewrite does not happen.
2) Access the page & go to view source of page
3) Verify it is well formed and links in valid url in terms of syntax also.
Thanks for the info.
Step 2: The HTML looks to be well formed. And just to confirm this I edited the code to be very basic, with just one link from a path field and another from the rte in the dialog.
<%@page session="false" import="org.apache.sling.commons.json.JSONException, org.apache.sling.commons.json.JSONObject"%> <%@include file="/apps/charlotte/global.jsp"%> <c:set var="currentMode" value="<%= WCMMode.fromRequest(request)%>"/> <c:set var="editmode" value="<%= WCMMode.EDIT%>"/> <c:if test="${(currentMode == editmode)}"> <div class="comp-edit-msg">Edit Message</div> </c:if> <div id="getgot-charlotte-placeholder" class="ajax-hdlebar-placeholder"></div> <div> <a x-cq-linkchecker="skip" href="${properties.gotactionUrl}.html">This is the test text</a> <cq:text property="gotdescription"></cq:text> </div>
Step 3 - there didn't seem to be any errors in the logs
Step 4 - I added in the attribute as requested HTML output is :
<div id="getgot-charlotte-placeholder" class="ajax-hdlebar-placeholder"></div> <div> <a href="https://forums.adobe.com/content/charlotte/got/my-account/profile-settings/link-account.html">This is the test text</a> <p><a adhocenable="false" href="https://forums.adobe.com/content/charlotte/got/my-account/profile-settings/link-account.html">Link</a> from a rte in the dialog.</p> </div>
I did notice that from the component that was working - the path from the dialog was being passed through resourceResolver.map(), before being output. This explains why this is working. (so currently any links not being passed through the resourceResolver isn't rewriting)
Could this point to the rewriter after the HTML generator not being set-up correctly? (although I thought that this was just using the same config that the resourceResolver was using?)
EDIT: Also to note. I've been running with the content on my localhost, and the links are being mapped correctly for the same components. That could be pointing towards an issue with the mapping config - I'll keep looking into that.
Views
Replies
Total Likes
Thanks for the links. I was expecting the OOTB to be able to handle the rewriting without having to define my own
I did notice that from the component that was working - the path from the dialog was being passed through resourceResolver.map(), before being output. This explains why this is working. (so currently any links not being passed through the resourceResolver isn't rewriting) .
I tried to update the config as mentioned in the second link, but that didn't seem to do anything.
I added: /content/<my-project-name>/-/
Views
Replies
Total Likes
Stenix wrote...
Thanks for the info.
Step 2: The HTML looks to be well formed. And just to confirm this I edited the code to be very basic, with just one link from a path field and another from the rte in the dialog.
<%@page session="false"
import="org.apache.sling.commons.json.JSONException,
org.apache.sling.commons.json.JSONObject"%>
<%@include file="/apps/charlotte/global.jsp"%>
<c:set var="currentMode" value="<%= WCMMode.fromRequest(request)%>"/>
<c:set var="editmode" value="<%= WCMMode.EDIT%>"/>
<c:if test="${(currentMode == editmode)}">
<div class="comp-edit-msg">Edit Message</div>
</c:if>
<div id="getgot-charlotte-placeholder" class="ajax-hdlebar-placeholder"></div>
<div>
<a x-cq-linkchecker="skip" href="${properties.gotactionUrl}.html">This is the test text</a>
<cq:text property="gotdescription"></cq:text>
</div>
Step 3 - there didn't seem to be any errors in the logs
Step 4 - I added in the attribute as requested HTML output is :
<div id="getgot-charlotte-placeholder" class="ajax-hdlebar-placeholder"></div>
<div>
<a href="/content/charlotte/got/my-account/profile-settings/link-account.html">This is the test text</a>
<p><a adhocenable="false" href="/content/charlotte/got/my-account/profile-settings/link-account.html">Link</a> from a rte in the dialog.</p>
</div>
I did notice that from the component that was working - the path from the dialog was being passed through resourceResolver.map(), before being output. This explains why this is working. (so currently any links not being passed through the resourceResolver isn't rewriting)
Could this point to the rewriter after the HTML generator not being set-up correctly? (although I thought that this was just using the same config that the resourceResolver was using?)
EDIT: Also to note. I've been running with the content on my localhost, and the links are being mapped correctly for the same components. That could be pointing towards an issue with the mapping config - I'll keep looking into that.
Everything looks fine to me. Mapping might be issue. To go systematically can you
* also add x-cq-linkchecker="skip" inside the rte hyperlink also? Also delete /var/linkchecker/http/* & /var/linkchecker/https/* and verify.
* If aem 5.6 make sure to install recommended hotfix because i know if you have broken vanity path it breaks the rewriting in some cases.
* Is it happening on all publish instance ?
Views
Replies
Total Likes
Based on this description, I wonder if link rewriting is disabled entirely. It sounds like it is never happening at that some of your components are working around this by manually calling resourceResolver.map(). It should never be necessary to do that for rewritten attribute (a:href in this case). You do need to call resourceResolver.map() if you are, for example, embedding links in JavaScript.
Views
Replies
Total Likes
Hello
Needed some help with similar issue and hope you guys can help.
With reference to issue related to links, should image tags be also handled using resourceResolver.map() ? I have configured URL mappings under 'Apacge Sling Resource Resolver Factory' in OSGi config and all a:href are getting transformed but not img src. (URL mapping: /content/myproj/-/ )
I added img:src to 'Rewrite Elements' under 'Day CQ Link Checker Transformer' settings but that also does not help.
My image ref is
<img src="/content/myproj/us/en/disclaimer/_jcr_content/centerPar/image.img.jpg/1429637916075.jpg" alt="int-devtest" title="Intdevtest" data-emptytext="Image">
and I like to remove "/content/myproj/" from it as incoming URL rewrite will take care of adding this to requests.
I tried this on a HTML control on a sample page but I get a nasty error:
<img src="<%=resourceResolver.map("/content/myproj/us/en/disclaimer/_jcr_content/centerPar/image.img.jpg/1429637916075.jpg")%>" >
Any help would be appreciated.
PS: Using AEM6 + SP1
Thanks
Views
Replies
Total Likes
OK - further progress.
It turns out that in the environment where I've been investigating this, the rewriting is not happening at all. Moving to another environment and also a local environment, then running through previous test I've been able to recreate the issue and identify the issue.
Justin was right - the links that are not rewriting are those that are contained in <script>, so we'll have to manually call the resourceResolver.map() for these links.
Views
Replies
Total Likes
write own transformer for image https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html
Views
Replies
Total Likes
Sham HC wrote...
write own transformer for image https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html
Thanks Sham.
But does that mean there is no configuration way to rewriting asset links? And shouldn't explicit resourceResolver.map() call take care of this?
This seems too common a requirements to me and shouldn't have to write code for this.
Views
Replies
Total Likes
D-Kay wrote...
Sham HC wrote...
write own transformer for image https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html
Thanks Sham.
But does that mean there is no configuration way to rewriting asset links? And shouldn't explicit resourceResolver.map() call take care of this?
This seems too common a requirements to me and shouldn't have to write code for this.
We filled enhancement require way back in 5.3 & did not see much demand. As of know not out of the box option and you need write own transformer.
Views
Replies
Total Likes
Views
Likes
Replies