Expand my Community achievements bar.

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

Adding target = "_blank" to CQ5 Image Anchor

Avatar

Level 4

Hi ,

   I have a requirement in the image component where a user is given preference to choose to open  links in new window (similar to text component) . So all i need is to add   target = "_blank" to CQ5 image anchor tag on user opts for new window . The OOTB image component uses Image class which actually outputs markup using  'image.draw ' .

From adobe documentation for Image class i was not able to see any helper methods to add extra tag attributes to added to the hyperlink around the image.

Any pointers on how i can achieve it ? Once way may be to update markup using jquery but I'm sure there will be much better way to do it

1 Accepted Solution

Avatar

Correct answer by
Level 10

If an AEM out of the box component does not meet your requirements, using JQuery API is a valid solution. We have many community articles that show how to use JQuery within AEM:

http://helpx.adobe.com/experience-manager/using/integrating-jquery-framework-cq.html

Here is an AEM community article that uses a JQuery API to build a custom carousel:

 http://helpx.adobe.com/experience-manager/using/custom-carousel-components.html

This article then talks about how to hook that component into a AEM dialog and add the component to the CQ sidekick:

 http://helpx.adobe.com/experience-manager/using/integrating-custom-carousel-component-cq.html

Hope this helps

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

If an AEM out of the box component does not meet your requirements, using JQuery API is a valid solution. We have many community articles that show how to use JQuery within AEM:

http://helpx.adobe.com/experience-manager/using/integrating-jquery-framework-cq.html

Here is an AEM community article that uses a JQuery API to build a custom carousel:

 http://helpx.adobe.com/experience-manager/using/custom-carousel-components.html

This article then talks about how to hook that component into a AEM dialog and add the component to the CQ sidekick:

 http://helpx.adobe.com/experience-manager/using/integrating-custom-carousel-component-cq.html

Hope this helps