Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Display Redirect URL instead of actual asset URL on page

Avatar

Level 1

I have set the redirect url property for an asset. Now when I author that asset on a page as a CTA or HREF, I want the page to show the redirect url value on hover of the link instead of the asset url authored.

 

I was reading through Apache Output Rewriting Pipelines as an prospective solution but I am finding very limited resources on it to understand the entire workflow and use case.

 

Need your help understand the best solution in this case.

4 Replies

Avatar

Community Advisor

Hi @akhilesh_gupta 

 

Please provide some more details and some snippets if possible?

Avatar

Community Advisor

@akhilesh_gupta - 

 

How have you set the redirect url property for an asset?

If you are only concerned about displaying the redirect URL on hover of the image,  You can implement client-side scripting, such as JavaScript/CSS, to display the redirect URL value as a tooltip or on hover of the CTA or HREF element. 

Avatar

Level 1

@Tanika02 

The redirect url is present in the "metadata" of the asset. Moreover I am concerned about displaying the redirect url on hovering over a link in the page. 

Avatar

Level 5

You can build a custom transformer. Just like LinkRewriter, you can build your own rewriter that can replace all links with your custom logic. And for paths starting with /content/dam, write a logic to retrieve redirect url from metadata and replace the url with it.

 

https://sling.apache.org/documentation/bundles/output-rewriting-pipelines-org-apache-sling-rewriter....

 

Hope this helps.