Hi Everyone,
I'm using /etc/map rules to remove /content/appname from requests. This works properly for incoming HTTP requests.
However, image tags rendered in Sightly templates are not rewritten. For example, if I have an image component at /content/app1/en/news/image, the src attributes in the image tag is not rewritten. It's still something like
<img src="/content/app1/en/news/image.img.jpg/123456789.jpg">
I would like it to be
<img src="/en/news/image.img.jpg/123456789.jpg">
I tried adding "img:src" to the set of mappings in Link Checker Transformer but this has no effect.
I assume I can create a custom rewriter/transformer to resolve this issue but it seems like this is something that should work automatically.
Any suggestions?
Thanks in advance,
David Frenkiel
Solved! Go to Solution.
Views
Replies
Total Likes
Thanks for all the comments, everyone. I believe this is the solution:
I need to configure the Sling Rewriter as described here:
http://wcm.io/handler/url/rewriter.html
It's a special configuration that goes under /apps/{appName}/config/rewriter/{configName}.
The important part looks like this:
<generator-htmlparser jcr:primaryType="nt:unstructured" includeTags="[A,/A,IMG,AREA,FORM,BASE,LINK,SCRIPT,BODY,/BODY,META,SOURCE]"/>
Also note that that the {appName} part of the configuration path MUST be a single node.
You can't have something like /apps/company/app1/config/... Sling will ignore it.
Views
Replies
Total Likes
Hi Jitendra,
Thanks for the suggestion.
I tried adding a few different mappings for /content/dam but it doesn't seem to make a difference.
For now I'm mapping /content/dam to itself so that it's effectively excluded from the mapping. So direct requests to images under /content/dam work correctly.
However, regardless of how I map /content/dam, image components continue to render with /content/app1 in the path.
Thanks,
David
Views
Replies
Total Likes
Yes you need to write a custom transformer.
https://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html
Views
Replies
Total Likes
Before developing custom re-writer to solve this problem, I would suggest, you raise a day care ticket and ask why is it not working?. Creating custom solution isn't the right move for every problem.
--
Jitendra
Views
Replies
Total Likes
Thanks for all the comments, everyone. I believe this is the solution:
I need to configure the Sling Rewriter as described here:
http://wcm.io/handler/url/rewriter.html
It's a special configuration that goes under /apps/{appName}/config/rewriter/{configName}.
The important part looks like this:
<generator-htmlparser jcr:primaryType="nt:unstructured" includeTags="[A,/A,IMG,AREA,FORM,BASE,LINK,SCRIPT,BODY,/BODY,META,SOURCE]"/>
Also note that that the {appName} part of the configuration path MUST be a single node.
You can't have something like /apps/company/app1/config/... Sling will ignore it.
Views
Replies
Total Likes
Hmmmm...
Maybe I'm mistaken. This doesn't seem to work without a custom transformer.
Views
Replies
Total Likes
Views
Likes
Replies