Link check transformer with Dataprops | Community
Skip to main content
Level 2
July 29, 2024
Solved

Link check transformer with Dataprops

  • July 29, 2024
  • 2 replies
  • 617 views

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?

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

Hi @vasudevaraogu 
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.

2 replies

arunpatidar
Community Advisor
Community Advisor
July 29, 2024

Hi @vasudevaraogu 
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 

Arun Patidar
Level 2
July 29, 2024

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? 

 

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 29, 2024

Hi @vasudevaraogu 
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.

Arun Patidar
kautuk_sahni
Community Manager
Community Manager
August 1, 2024

@vasudevaraogu 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!

Kautuk Sahni