How to make my links to anchors on the same page work
Asked by Stuart Gros-Dubois:

I have followed the instructions on the Anchors page. I am placing anchors at specific points in the article I am writing. Links at the top should link to the anchors in the article on the same page.

Now when I click a link, the URL is appended with #id-\<PageName\>-\<AnchorName\>  
Otherwise nothing happens. No page reload reload, no scrolling to the anchor.

I am using Chrome v.55


Answers:
author: Stuart Gros-Dubois
body: \*2-years-later update\*

At one point my company updated to a newer version of Confluence and this problem vanished. Sorry, I cannot remember when exactly nor which version the patch was introduced in. Best bet is to try with the latest available Confluence and browser versions.

[@Bernd Schneider](/t5/user/viewprofilepage/user-id/844026) yours sounds like a different issue altogether. I was not experiencing this shortening behaviour.

comments: author: Bernd Schneider
body: Ok, thank you, Stuart!


author: Rob Woodgate
body: Hi Stuart,

The page will only scroll if the anchor is off the bottom of the visible page. That catches some people out, but I'm guessing from your description that you know that.

So, either the link is wrong, or the anchor is wrong.

**Link:**

When you add an anchor link, the format should be Space:Page#Anchor, and the link needs to be added in the Advanced \> Link text box.

Is that exactly what you see when you edit the link?

**Anchor:**

When you edit the page is the anchor macro in the right place, and when you edit the anchor is the name of the anchor the same as the name of the link?

comments: author: Stuart Gros-Dubois
body: Thanks for your reply!

Yes the anchor to which the link should link is much farther down the page and not in the current view when I click on the link.

**Link**:

Although the link is on the same page as the anchor, I followed your instructions using the full "Space:Page#Anchor" but when I save the changes, then go back again to editing the link, I see that it has automatically removed the Space:Page components, leaving only #Anchor.

Yes to Advances \> Link text box.

**Anchor**:

Yes to both, I have checked many many times


author: Rob Woodgate
body: Yup, Confluence removes the parts of the anchor link it doesn't need, but sometimes if the original anchor link wasn't correct then you get a problem, and that problem isn't obvious because part of the link has been removed!

Ok, if the link is right and the anchor is right, the next thing is to try it in another browser. Do you get the same issue in both Firefox and Edge?

Edit: I've just seen your reply to Randy. As anecdata, it's working on my (Cloud) version, so not a bug as such (although it might be a bug for your combination of Confluence and browser versions).


author: Bernd Schneider
body: Hi,

a colleague of mine currently also has a problem that looks similar. Links are shortened (e.g. #GPS =\> #G), but not the anchor, so that afterwards the links points to nowhere. We couldn't find a rule, when exactly this happens. Also it is possible to correct the links, at least for a time.

Is there a solution to this two year old problem here?

Thanks \& best regards,  
Bernd


author: Randy
body: open the page source and search for id-\<PageName\>-\<AnchorName\> there might be some URL encoding or typo in your link that causes the issue.

comments: author: Stuart Gros-Dubois
body: Thanks for your answer. I did as you said, I am able to find my anchors \<PageName\>-\<AnchorName\> within the page source. It cannot be a typo because I noticed it is also doing it with the table of contents macro.  
I noticed one of the previous pages that I created some years ago, that definitely had this anchoring/linking working, now does not work.  
Maybe it is a bug in Confluence?