Anchor links do not work
Asked by Madhav Gudimetla V:

Using confluence is so simple and easy. But, I have been having a nightmarish time trying to get Anchor work for me. I am using "Confluence 1000.0.0-66d80941701".

On a page, say, "https://\<\>.com/myspace/main page/sub page/my page1", I created an anchor with the name bottom. (please note the spaces in my URL).

On another page, say, "https://\<\>.com/myspace/main page/my page2", I created a link using Advanced tab selection, and pointed to anchor my page1#bottom.

I Published both pages. Clicking on the link NEVER takes me to the anchor location. Always takes me to top of the page in "https://\<\>.com/myspace/main page/sub page/my page1"

I followed the example <https://community.atlassian.com/t5/Confluence-questions/Insert-an-Anchor/qaq-p/1013116> ... but it doesnt work!

Need this to be resolved ASAP for me to create a bi-directional traceability in the spec I am writing. Kindly help!


Answers:
author: Max Foerster - K15t
body: Hi Madhav,

how have you configured the link to your anchor on the other page? From what you wrote I assume both pages are in the same space. By entering the page name as it is (with spaces) and adding the anchor name you can make it work. I just tested it again because I like to use this feature as well. So just add on the advanced tab: "page name with spaces#anchorname" without quotation marks and please let me know if it works for you :) If not, please add a screenshot of the link configuration, the anchor name, and page title so we can build the link together.

Best,

Max

comments: author: Madhav Gudimetla V
body: Yes, I am working in the same confluence space.

I just now created sample / dummy pages with page names containing spaces, and having sub pages within. I created an anchor inside one of the sub pages and a link in one of the top pages. I am able to navigate and it works. (I did not include draw.io images in this experiment!)

Unfortunately, when I do the same on my main confluence spec (which includes draw.io images), I am always getting redirected to top of the page.

One thing I found out thru this exercise is I am using draw.io plugin for drawing images in confluence. And I just now found that draw.io plugin is playing spoilsport. When my anchor on the page is way down below, and I have a fairly large draw.io image on top of the page, the image load re-positions the view to the top of the page! As a result, Anchor gets overridden!

So, I attribute the functional misbehaviour of Anchor in Confluence to the presence of a draw.io image in the page.

Without draw.io image, the anchor is working like a charm!

I will have to accept your answer. Create a new ticket with draw.io plugin issue.

Thanks for your time, Max! You are indeed the community champion!


author: Max Foerster - K15t
body: Don't make me blush! You're welcome. But your findings are interesting. I will keep an eye out and test some other embedded contents and how they interact with anchors. And hopefully, there will be a fix soon for your specific issue!


author: Stephan Gehring
body: We have noticed similar issues: clicking a hyperlink in a draw.io figure jumps to the wrong place on the same page. Not totally off, just too far down. Sometimes it works better, sometime worse.


author: Debra Anderson
body: I'm having a similar problem


author: Leontien Coolegem
body: Me too, draw.io image on page, anchor doesn't work


author: Kikadass
body: It happens with anything that loads after the anchor has taken you to the right place.   
In my case, I have a large confluence page with a Table of Contents at the top. The table of contents loads a bit later than the anchor effect. So for a split second the anchor took me to the right place, but then everything shifts down after things load.   

I know this happens on my page and I can just go down to search for what I was looking for. But if I am sharing the link to someone else for them to read some information... they will be lost on what am I trying to share with them.   

[@Madhav Gudimetla V](/t5/user/viewprofilepage/user-id/2773864) Did you create the separate ticket about the draw.io issue?  
Could you send a link here?


author: greg calica
body: **I have finally figured it out.**

***Well maybe I figured out my "it" and the community can use my solution as way to figure out their "it"s.***

I'm exclusively using MS' Edge browser. I haven't tried the others, so your mileage may vary.

So, I was putting in two anchors in a page where one would be linked elsewhere within the same page and the other from another page (actually from a Scroll imageMap). No matter what I did based on the suggestions provided by the others, I could not get the imageMap external link (the other options don't allow for the #) to work. I gave up and went to the other anchor link (the one that links within the same page) and it worked. Just by chance I looked at the URL and what do you know--**it looks NOTHING like any of the documentation and blogs I seen to date**. I'm gonna do my best to explain the URL without disclosing my actual. I hope my explanation is clear.

* On my page called "My Page" I have two anchors: #paragraph_one and #paragraph_two
* Using the Link utility to setup a link to an anchor within the same page works
  * just the #\<anchor name\> format works
  * the \<page name\>#\<anchor name\> format works
  * I'm willing to bet that the <https://site.com/confluence/>\<page name\>\<page name\>#\<anchor name\> format would work (IDK, didn't bother testing)
* Clicking on this link revealed the following URL
  * <https://site.com/confluence/My+Page#MyPage-paragraph_one>
* Note the format: **#\<pagename\>-\<anchor name\>**
  * no space between the words of my page's name
  * the dash that separates the page name and anchor name
* Using this format to specify the external link for my other page's imageMap (<https://site.com/confluence/My+Page#MyPage-paragraph_two>) **"worked"**
  * I placed the word *worked* in parentheses because, there is still some bugginess in that the anchored point is presented out of the viewable area
  * I think this is due to the sequence of how the page loads (images get loaded after the anchor, which pushes the anchor out of view)
  * I just placed the anchor I little further up than the obvious point and the experience is close to what I want

comments: author: Colin Smart
body: This worked for me too - thanks [@greg calica](/t5/user/viewprofilepage/user-id/5327479) I was about to give up!!

ps. I was using Chrome, and on Confluence 7.4.11


author: arthurgoldberg
body: **Much** too complicated and cumbersome. Effectively broken.


author: arthurgoldberg
body: **Much** too complicated and cumbersome, IMHO.


author: Mai Siam
body: Hi everyone- I was able to solve the issue today

Create anchor at the location you want it to direct to:

Add Anchor Marco

Anchor Name #testname

then insert link using any page in your sapce

Link: Page name##testname

Link Text: Test Name

the double hashtag did it for me.

hope this helps

comments: author: Rodney Hughes
body: We are now on Server v7.2.1

I placed an anchor on a page titled "page anchor link 1" and called it "Target"

Then on another page I placed an "Advanced Link" with text "jump to target" and the following link

page anchor link 1##Target

it went to the page, but not the anchor point

I changed the Advanced link to just one #

page anchor link 1#Target

That worked!!

It would seem that there may be an additional problem that the link is "page title" dependant i.e. change the page location or title and the link would be broken.

So I tested that and changed the target page title

Good news .. the Advanced Link automatically updated

:)


author: Brandon Zupancic
body: So, in other words, anchor links work exactly the same as a hyperlink INSIDE of Confluence, but anchor links cannot be linked to from outside of Confluence. I'm struggling to understand why you would even use an anchor link instead of a regular hyperlink inside of Confluence.

It would be far more valuable to be able to insert an anchor link inside a document that you can then link to from an external source. For example, if you have a lengthy Confluence document with dated updates, it would be extremely valuable to add an anchor link to each date that you can share to make it easier for colleagues to click through to the specific information they need without having to scroll through a long document. That's just one example of how an anchor link SHOULD work. There are dozens of other, similar use cases. For now, anchor links serve no purpose that a hyperlink does not already serve.

comments: author: Rodders Hughes
body: Having an Anchor inside a Confluence page ...

Putting a link in an external Word doc or PDF or some other web site to that Confluence page Anchor is only useful if the reader has User access to your Confluence site.

We produce Word and PDF documents for an industry public web site. We use Anchors and links to Anchors on the Confluence page. When we export the Confluence page to Word or PDF, it correctly converts the links to Anchors into links to the document location on my PC and then to the Anchor location in that document.

"Normal" hyperlinks dont do that as they would always point to the Confluence page.


author: Revital Ferster
body: Found a solution.

I have tried all the suggestions above. None worked for me from outside of Confluence.

Finally I have used the html macro instead, with html code for a bookmark

And voilla - finally I can refer to this bookmark from outside

Example:

The bookmark: Within the html macro I have put: \<h2 id="AAA"/\>

Then I could refer to this bookmark by : page-url#AAA


author: Lawrence S Harris
body: Using the server version, it's a shame the anchor links don't work if accessed from outside of confluence.

Anchors are a very poor implementation of something that should be a basic feature and should be easy to figure out. Instead it is arcanely implemented and non-functional in a wide variety of possible use cases for no apparent reason.

I also see that the cloud implementation allows implicit anchors for section headers, however, that implementation breaks completely if we add numbered headers.

Furthermore, the server version doesn't do implicit anchors on section headers at all. I cannot explain why very basic functionality between implementations can't be synchronized.


author: Joseph Calaway
body: So this may be an issue because of user error (as I discovered with myself). I'd suggest validating that your anchor macro itself doesn't have a # in the naming convention. Eg, use anchorname in the macro, not #anchorname. Then in your link, use #anchorname and it should work.


author: Bill Rudy
body: All, I was having this problem until I realized something...you can't select the page you're linking to, then go and add JUST the anchor in the Advanced field. You have to go to Advanced and add BOTH the page name, the "#" character, and the anchor name (keeping in mind it is case and space sensitive). That made it work for me. Frankly I find that confusing and not documented accurately or clearly here <https://confluence.atlassian.com/conf76/anchors-1018768661.html#Anchors-Step2> , but hey, go with what works. :) We are on Server 7.4.1 FYI, but I suspect this is true going back many versions.

comments: author: Mike Frohme
body: This worked for me ... finally! (at least within Confluence) ... I guess I have always missed the 'Advanced' recommendation. I have not been successful with anchor links from external pages , but will try again.


author: ABoerio
body: I still see a big problem when trying to link to anchors from outside confluence, eg from a web page, a pdf file, email or whatever else.

In these cases I normally use the absolute link to the page Id (from "Share link"), because page titles might change. If I try to add #anchor name to these links, it just goes to the page top. :-(


author: Rodney Hughes
body: Confluence Cloud claims some sort of fix <https://jira.atlassian.com/browse/CONFCLOUD-62589>

Pending response on Confluence Server <https://jira.atlassian.com/browse/CONFSERVER-58628>


author: Gary
body: I have the same problem. I don't think Anchors work.

The URL I'm trying to make work is:

<https://confluence.MyCOmpanyDomain.com/confluence/display/DCPH/Test%3A+Word1+Word2+Word3#myanchor>

I tried defining my anchor as both #myanchor and myanchor (in case the octothorp is required in the coding, unlike using the traditional \<a .... \> tag in HTML. In both cases, when I use my anchor in the URL, it goes to the top of the page, not the anchor.

The HTML snippet in my page source code is:

\<td\>  
\<div class="content-wrapper"\>  
\<p\>  
\<span style="color: rgb(0,51,102);"\> \<span style="color: rgb(0,51,102);"\> \<ac:structured-macro ac:macro-id="30a27554-999c-45f7-a2fc-ed47f53b34ab" ac:name="anchor" ac:schema-version="1"\>  
\<ac:parameter ac:name=""\>#myanchor\</ac:parameter\>  
\</ac:structured-macro\>Text for myanchor\</span\> \</span\>  
\</p\>  
\<p\>  
\<span style="color: rgb(0,51,102);"\> \<span style="color: rgb(0,51,102);"\>\[ OCS \]\<br/\> \</span\> \</span\>  
\</p\>  
\</div\>  
\</td\>


author: Rodney Hughes
body: Hi am having similar problems ... :(

I want to be able to email a link to a specific anchor on a specific page

As far as I can tell I have used the right formatting as follows

Anchor name is UNTICK

Page name is 1 Quick Start Guide

Space Key is CORES

<https://groups.org/display/CORES/1+Quick+Start+Guide/#1QuickStartGuide-UNTICK>

When I email that link to myself, when I click the link in the email it takes me to the correct page but not to the Anchor point, just the top of the page.

I am currently using Sever 5.8.16 but we will soon be upgrading to 6.15

comments: author: Max Foerster - K15t
body: Hi Rodney,

that doesn't look right for me. Could you try:

<https://groups.org/display/CORES/1+Quick+Start+Guide#1QuickStartGuide-UNTICK>

Best, Max


author: Rodney Hughes
body: Thanks Max

tried that ... that also open the right page but doesn't skip down to the Anchor point

I have spotted some other references that indicate that linking to an anchor from outside the Confluence instance has a bug and doesn't work.

<https://jira.atlassian.com/browse/CONFCLOUD-62501>


author: Anton Khvorov
body: Any updates on that? I have the same issue


author: Don Javier
body: The same for me...


author: ABoerio
body: I guess it's still the same limited functionality.

Anchors work **only** if you refer to them from inside Confluence (and not from an external web page) **and only** if you set the link as advanced link **and only** if you set the link using the page title, followed by # and by the anchor name.

![adv.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/137785i5F43D643063FAF36/image-size/large?v=v2&px=999 "adv.jpg")

That means you'll loose the link, in case you modify the page title.

For us it's a big limitation :-(, but that's how it is.

Ciao, Andrea


author: Lawrence S Harris
body: Thanks, this was the key for me to get \*something\* working.


author: joshuataylor
body: It's hard for me to understand how, years later, this hasn't been addressed. I often share links from Confluence with coworkers and I often want to point to a specific spot on a big page. Seems like basic functionality for a web page.


author: Jerry Destremps
body: That is the STUPIDEST thing I've ever heard. It's so easy to implement as an outside linkable anchor in a page. Everyone does it with normal HTML. Why can't Atlassian make it happen with Confluence? I send my boss a link to a specific place in the page, and it doesn't scroll down to it. Thanks Atlassian. Get real.