Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

463 views 24 9
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