It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unexpected HTML returned from user macro

Hi.

I created a user macro that accepts a confluence-content type parameter and uses it as the href attribute of an <a> tag. It works perfectly even if I add a title that doesn't exist, the class I provide are the one being applied, etc. No surprises there.

The only big surprise is that as soon as I define an external URL (for instance, www.atlassian.com) it immediately changes the value of the class attribute to "external-link" and the value of the href turns into "<base_url>/display/<space>/<external_url)" (e.g. http://localhost:8090/display/KM/www.atlassian.com).

 

Code (compact):

## @param Title:title=Title|type=string|required=true

## @param Url:title=URL|type=confluence-content|required=true

## @param Type:title=Link Type|type=enum|enumValues=standard,light,no-decoration|default=standard



<a class="link-type-${paramType}" href="${paramUrl}">$paramTitle</a>

 

Parameter Values

 

Result:

<a class="external-link" data-hasbody="false" data-macro-name="custom-link" href="http://www.vitorcastelo.me/km/display/Support/www.google.com" rel="nofollow">
Google Search
</a>

Expected:

<a class="link-type-standard conf-macro output-inline" data-hasbody="false" data-macro-name="custom-link" href="www.google.com" rel="nofollow">
Google Search
</a>

 

Did anyone already bumped against this kind of behavior in a user macro?

Thanks.

1 answer

1 accepted

0 votes
Answer accepted

I believe Atlassian recently made changes to how external links are viewed. External links will open in new window. It might have something to do with this behavior. Try creating a support ticket with Atlassian

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

306 views 9 7
Join discussion

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