Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected HTML returned from user macro

Vitor LC September 16, 2019

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
jira guy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2019

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
AUG Leaders

Atlassian Community Events