How can I create a link in the Space sidebar that will be opened in a new tab?

When I insert a link anywhere in Confluence, the links always open in the same tab. We are using the Space sidebar links to store several assets about the project, like location of design files (, project canvas (, etc..

Is there a way to make those links open in a new tab automatically?


1 answer

1 accepted

1 vote
Accepted answer

You set the "target" property of the <a> tag to "_blank". You can do this with jQuery in your custom HTML header. However, if you only want certain links to open in a new tab, that will require you to identify those links (either by class or ID).

Here's an example where I have all "external" links open in a new tab:

<!-- Add target="_blank" to the URLs so that external links open in new browser page -->

How can I identify the sidebar links by class?

Ok... so no way to add a custom class, but I can see what the theme is defining and use it.


Right click and view source or view element. Look at the code and see what it says. In your particular implementation, I don't know if there's a specific class that they use, but this is where I would start.

Davin Studer Community Champion Feb 13, 2014

You would probably need to do something like this.

AJS.$('.plugin_pagetree_children_content a:contains("##Page Title Here##")').attr('target','_blank');

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Dec 18, 2018 in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

458 views 3 18
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you