Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Confluence remove HTML target attribute from link in user macro


I wrote a "User Macro" to add links with some options.

In the user macro is a link with the HTML attribute "target", but if I'm using the user macro, the "target" attribute is missing.

What is my fault? 

SIMPLIFIED user macro CODE (there is much more code in the user macro)

## @param Target:title=How to open the link|type=enum|enumValues=New,Current|default=Current Window|desc=Defines how the link will be opened.

#if( $paramTarget == "New" )
#set( $target = "_blank" )
#set( $target = "_self" )

<a href="" target="$target" data-target="$target">Google</a>


The "target" attribute is set correct, see the "data-target" attribute.
The HTML source code resulting in

<a href="" data-target="_self" class="external-link conf-macro output-inline" rel="nofollow" data-hasbody="false" data-macro-name="av-test-macro-code">Google</a>


I knew the workaround "adding javascript code to add the target attribute based on the external-link class". 

2 answers

Hi @Marc Wampfler, have you found a solution in the meantime?

Hi @Marc Wampfler and @Ulrik Schoth , i suppose this issue relates to CONFSERVER-54958

Best regards, Marco

0 votes
Brant Schroeder Community Leader Sep 15, 2021

@Marc Wampfler 

Take a look at this article

Looks like the target needs an _ in front of it.  You can try it and see if that works.

The linked article shows the underscore only in the example 

<A href="newwindow.html" _TARGET="_blank"_>a new window</A>

and not in the preceding text: You need to add a TARGET = "_blank" to the <a href> HTML tag.

I guess the underscore in the example is a typo: If you use it, the whole attribute goes through but the browser does not recognize it.

So, this suggestion does not help unfortunately.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

354 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you