Display Redirect URL instead of actual asset URL on page | Community
Skip to main content
July 4, 2023

Display Redirect URL instead of actual asset URL on page

  • July 4, 2023
  • 2 replies
  • 1157 views

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.

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

2 replies

iamnjain
Community Advisor
Community Advisor
July 4, 2023

Hi @akhilesh_gupta 

 

Please provide some more details and some snippets if possible?

Tanika02
Level 7
July 5, 2023

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

July 6, 2023

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

mahi1729
Level 4
August 14, 2023

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.html

 

Hope this helps.