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

How to format anchor url?

Jim Orion I'm New Here Apr 13, 2020

I have RTFM :) and the advice is to write as http://myconfluence.com/display/spacekey/pagename#pagename-anchorname .

My page name is similar to a:b, anchor name is c-d and space is s

I have tried

https://localserver/display/s/a%3Ab#a:b-c-d - expecting this one to be closest to docs

https://localserver/display/s/a:b#a:b-c-d

https://localserver/display/s/a%3Ab#a%3Ab-c-d

https://localserver/display/s/a:b#a%3Ab-c-d

But not having any luck. Can anyone point me in the right direction?

TIA!

1 answer

1 accepted

0 votes
Answer accepted

Hi @Jim Orion 

did you try to set the Anchorlink via link dialog? -> Set link -> Advanced?
Than reuse this created link - may be the fastest way.

Pay attention to the information box you find in documentation.  

  • Anchor names are case sensitive
  • Enter page and anchor names with spaces when you link to them in the same Confluence site
  • If you're linking to an anchor on a different page that has special characters in its name, where the URL displays a page ID rather than a name, you should still enter the page name when linking to it

Creating the link by hand can be very tricky especially when you have special characters in it. Another way could be using TOC macro and create a link to a heading. 

 

Jim Orion I'm New Here Apr 15, 2020

I got there in the end - thanks!

I had used that dialog before, but went back to it and saw the error for link a:b#c-d saying that the space 'a' was not found. So i added the space explicitly to it and made it space:a:b#c-d and it created a link that worked :)

It turned out that the page name part of the anchor has spaces stripped out and that was the problem.

 

So if

a='1234'

b='my page title'

page name=a:b=1234:my page title

anchor=c-d

then the anchor that works is /{a:b urlencoded}#{a:b spaces stripped}-c-d

which is

https://server/display/space/1234%3Amy+page+title#1234:mypagetitle-c-d

not that intuitive really. if only it had been

https://server/display/space/1234%3Amy+page+title#c-d

it would have been far simpler! 

Like Fabienne Gerhard likes this

Great that it worked out 👍🏻 - what a tricky little thing those anchors 🙄 believe me made my own experiences 

Suggest an answer

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

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,501 views 6 6
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