Hi Team,
Is there any way we can transform the Data-props href URL links using link check transformer if the component rendering using client side rendering and the props are available as data-props in DOM for react frame work to render.
I have a component which rendering DOM as below
Ex: data-props="{"lpos": "zip","theme": "light", "alignment": "center", "buttonText": "ZIP","priority": "primary","href": "/content/brand/country/private/promo/zip"
}}"
the alias values mapped for href link pages mentioned as private=privat and promo=Forderung and zip=plz
Now in dispatcher is it possible have link check transformer to convert the URL from /content/brand/country/private/promo/zip to /content/brand/country/privat/Forderung/plz
so that end user will access will see the alias matched URL instead of the original URL. The same working if we use sightly component with serverside but do we have any option in this scenarios?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Hi @vasgurug
1. It will not impact other transformers since they execute sequentially.
2. There might be a slight performance degradation if you run complex logic within the transformer implementation. For instance, the Link transformer checks all href attributes and appends .html. The performance impact will depend on the complexity of your custom logic.
Moreover, compared to JavaScript logic, Sling rewriters can offer better performance because the modifications are applied on the server side only once during page output generation and then cached at the dispatcher.
Hi @vasgurug
technically you can rewrite any part of HTML using sling transformers
https://wttech.blog/blog/2019/how-to-use-sling-transformers-in-aem/
https://wcm.io/handler/url/rewriter.html
Thanks @arunpatidar for the reply.
Two questions 1. if we use sling transform factor to serialize the output as an HTML apache sling rewriter will this have any impact on the existing link check transformer?
2.If each and every href while transforming need to go through this rewrite process will this have any performance impact if large number of components contains multiple href?
Hi @vasgurug
1. It will not impact other transformers since they execute sequentially.
2. There might be a slight performance degradation if you run complex logic within the transformer implementation. For instance, the Link transformer checks all href attributes and appends .html. The performance impact will depend on the complexity of your custom logic.
Moreover, compared to JavaScript logic, Sling rewriters can offer better performance because the modifications are applied on the server side only once during page output generation and then cached at the dispatcher.
@vasgurug Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes