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

How to format anchor url?

Jim Orion April 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
Fabienne Gerhard
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 14, 2020

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 April 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
Fabienne Gerhard
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 15, 2020

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

Atlassian Community Events