link to anchor doesn't work

Derek Dokoto July 20, 2017

I added an anchor  #thisanchor near the bottom of the page (with at least a page  worth of text following it.)

I added the link near the top of the page.   The unqualified link did NOT link to the same page.  It added a bogus prefix URL when saved.  So I added a fully qualified link for that same page where the link was inserted so it would link within the page.

when I hover over the link it says the right thing - "Go to link #thisanchor on this page".

But it doesn't do anything.  The page does not move to the bottom anchor.

There is no TOC defined on this page.

The anchor only shows up in 'edit' mode as per design.

This is such a basic use of anchors and it doesn't work.   Help!

Confluence 5.10.8

19 comments

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2017

No idea, if your version is different from mine.
I use version 4.3.7 (server) and adding anchors is pretty straightforward.

To enter the anchor:
* Insert > Other macros > Anchor
* Type "My Anchor" at "Anchor Name"

To link to the anchor:
* Highlight link text
* Insert Link > Adcanced
* Type "#My Anchor" at "Link"

Derek Dokoto July 21, 2017

As stated, I'm running 5.10.8 which is different from yours.

Yes, the insertion and link to anchors is quite straightforward.   Only thing is that it doesn't work for me.  I'm used anchors in many CMS and/or twiki systems and it always worked for me in the past, just not in confluence. 

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 24, 2017

I checked the latest version 6.3 => https://confluence.atlassian.com/doc/anchors-139442.html and the cloud version => https://confluence.atlassian.com/confcloud/anchors-724764900.html, the description is the same as mine.

Have to tried to follow the docu for your version?

Derek Dokoto July 24, 2017

This isn't my first rodeo. That's the first thing I did was read the documentation. It's a bug. My company admin can request support from Atlassian support.  The issue is still open.

Like Isaac Joseph likes this
Doug Swartz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2018

@Derek Dokoto Did you ever get a resolution to this.  We are on Confluence 6.2.4 and have the same problem. following the instructions for placing links to anchors on the same page, the anchor gets generated into the link with a prefix. The prefix is the pagename with spaces removed. In other words, On a page named "This Page", with an anchor name "an1", here's what gets generated for an anchor URL:

https://myConfluence/display/mySpace/This+Page#ThisPagean1

 

Of course this doesn't work, because the anchor is really named an1, not ThisPagean1.

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2018

Can you paste the page source here? At least where the link was inserted and then the code around the anchor. Sometimes spurious tags can get pasted into a page.

 

You are clicking Insert Link and then the clicking the Advanced tab to insert the link?

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 22, 2018

@Doug Swartz

I don't know about "the same problem" (there might be something, who knows?) but what you describe, the fact that a prefix is added to the link, is correct behaviour.

It is correct because the same prefix is automatically added to the anchor. You can see it if you have a look at the source code.

Derek Dokoto January 19, 2018

I am no longer working at the company that used Confluence.   The tool had a smattering of "experts" around my company.   I consulted with all of them at the time and it was a limitation/defect of Confluence and was never resolved before leaving the company.    In principle, Confluence is a great tool.  Unfortunately with the number of significant glitches and oversights and missing functionality, adoption rate was limited and most pages are simple text files preventing a great deal of promise suggested by the tool.  

Sorry I can't be helpful.   The tool is broken.

Like # people like this
Elliott Collins July 9, 2018

Just wanted to flag that anchors still don't work. It'd be *really* great if they did.

Like # people like this
Tatyana Kuznetsova July 26, 2018

I have a similar issue - whenever I try to create the same page anchor, the prefix containing the page name gets inserted automatically. So if a create an anchor ("section 1") using the anchor macro, in order to link to it, I need to say #mypage-section1 (where 'mypage' is the name of the page). 

This is not the behavior that I am looking for - I just want the same page anchor (that does require reloading of the page)

Please advise if this is a bug and if there is a workaroudn for this.

Thank you,

-Tanya

Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 26, 2018

So, if you create a link to "#mypage-section1" it does work? But a link to "'section1" does not work? Is that what you tried?

Like Isaac Joseph likes this
Tatyana Kuznetsova July 26, 2018

@Steffen Heller

Exactly - it automatically inserts #mypage in front of "section1".  If I link to "section 1" it does not work.

Like Donna Breckenridge likes this
Steffen Heller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2018

But YOU enter ONLY "#section 1" and then CONFLUENCE adds the pagename to it, making it "#mypage-section 1" and then the link DOES work? Is that correct?

I am just trying to find out if same page links do not work at all for you or if you are just confused by the fact that confluence internally adds the pagename to a link.

Tatyana Kuznetsova July 27, 2018

@Steffen HellerIf I link to pagename-#section 1 then it works (and it also forced the reload of the page)

If I just link to #section 1 then it does not work.

Doug Swartz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2018

@Tatyana I don't have any idea why Atlassian decided to make anchors work the way they do. I agree that forcing a page reload to go to a link on the same page is poor behavior. Sometimes, building a page from SQL requests or other external resources is expensive and slow.

I've decided to simply use the HTML macro when I want normal link behavior.

Like Sascha Manns likes this
Tatyana Kuznetsova July 27, 2018

@Doug SwartzThank you - unfortunetely, my version of WIKI does not offer "HTML macro"

mattcobb September 11, 2018

It's a bug: https://jira.atlassian.com/browse/CONFCLOUD-62589

Please vote for it

Joshua Landman January 28, 2019

Apparently in Confluence the real anchor name =  #page name-anchor name.

So link to http://yada.yada.yada/page name#page name-anchor name

That's how I got it working. 

Not sure if that is intentional on Atlassians part - it's wonky but functional

Also I attached it to a block element -- like a table header... 

Like # people like this
Ravikumar B July 11, 2019

Apparently, Confluence Cloud offers wiki markup to add hyperlinks. The syntax is [page name#anchor name]. For example, [About Us#contact].

David_Harris August 2, 2019

Here's a solution that works:

  1. Embed an HTML macro where you want your anchor
  2. Add the following inside the HTML box: <a id="my-anchor"></a>
  3. Save the page
  4. Now link to your page using any of the usual methods (title-based url, shared-url, page-id url) and add #my-anchor to the end
  5. Rename my-anchor in both places to match whatever you need it to be
Like Isaac Joseph likes this
Ralf Gartmann February 18, 2020

Made my day...

Like # people like this
steve_dunn February 8, 2022

Doesn't work any more as the HTML macro isn't available (at least not in my installation at work (could be configuration, could be a bug, could be that they couldn't be arsed to maintain it - who knows!))

Hauke Hörhold
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 8, 2019

I can't believe this problem still exist!

PLS FIX! :-S

Like # people like this
Deleted user November 20, 2019

Seriously? This was reported over 2 years ago, and it's not even a complex subject. Imagine how long it must take them to address real issues.

Like # people like this
kosterskiy December 10, 2019

Scenario

  1. Insert link (ctrl+k)
  2. Advanced
  3. Add name of document (not URL) and anchor in "Link", e.g. "Terms and conditions#about"
  4. Done
Deleted user January 16, 2020

So they fixed this by getting rid of anchors all together. Absolutely brilliant.

Hauke Hörhold
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2020

As described here, the macro really is gone now: https://community.atlassian.com/t5/Confluence-questions/Anchor-Macro-Not-in-Confluence-Cloud/qaq-p/1019247

Really? I mean... REALLY?! Money back plz

laralg
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 21, 2020

If none of the solutions work for you, and your confluence is a bit old your problem might be that you had this old plugin installed Confluence Iphone plugin.

https://jira.atlassian.com/browse/CONFSERVER-20319

Donna Breckenridge April 27, 2021

I am on here looking for help with the anchors as well.  Every time I edit the pages to add new content, I must go and repair all of my anchors to remove the extra text that pops in the anchor and causes an error on the page.  Can you assign someone to work with us to fix?  I am not on old version and I know better than try to use a plug in.

Like # people like this
steve_dunn February 8, 2022

<tumbleweed>

Incredible that they actually charge money for this product!

steve_dunn February 8, 2022

I'm flabbergasted that Atlassian think it's acceptable that users have to follow the instructions below **just to get a link to an anchor on a wiki page**!  Incredible! I have a glossary page where I'd like a link to every gloassary item, but there's no way in the world that I'm manually crafting 100+ URLs like this.  Appaling.

--------------

Link to an anchor from another web page or another Confluence site:

Use a full URL in the following format:

Link syntax

Examples
http://myconfluence.com/display/spacekey/pagename#pagename-anchorname

http://myconfluence.com/display/DOCS/My+page#Mypage-bottom

http://myconfluence.com/display/DOCS/My+page#Mypage-importantinformation

Notes about the full URL:

The page name is repeated in the URL, after the # sign. The second occurrence of the page name is concatenated into a single word, with all spaces removed.
There is a single dash (hyphen) between the concatenated page name and the anchor name.
The anchor name in the full URL is concatenated into a single word, with all spaces removed.
The anchor name is case sensitive.
If the page name contains special characters, where the URL displays a page ID rather than a name, the link to an anchor will look more like this http://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page1!-anchor 
In this example the page title is Test - Page 1! and the anchor name is anchor.

steve_dunn February 8, 2022

I'm flabbergasted that Atlassian think it's acceptable that users have to follow these instruction **just to get a link to an anchor on a wiki page**!  Incredible! I have a glossary page where I'd like a link to every gloassary item, but there's no way in the world that I'm crafting 100+ URLs like this.  Appaling.

--------------

Link to an anchor from another web page or another Confluence site:

Use a full URL in the following format:

Link syntax

Examples
http://myconfluence.com/display/spacekey/pagename#pagename-anchorname

http://myconfluence.com/display/DOCS/My+page#Mypage-bottom

http://myconfluence.com/display/DOCS/My+page#Mypage-importantinformation

Notes about the full URL:

The page name is repeated in the URL, after the # sign. The second occurrence of the page name is concatenated into a single word, with all spaces removed.
There is a single dash (hyphen) between the concatenated page name and the anchor name.
The anchor name in the full URL is concatenated into a single word, with all spaces removed.
The anchor name is case sensitive.
If the page name contains special characters, where the URL displays a page ID rather than a name, the link to an anchor will look more like this http://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page1!-anchor 
In this example the page title is Test - Page 1! and the anchor name is anchor.

eMail WorkBench March 7, 2023

Almost a decade later [feels like two decades]] and "Anchor" links are still not working.
If it is working where do I prep for this [nuclear science level] how to use knowledge?

Like Sylwia Soćko likes this
Michael Reekie _g_ July 17, 2023

I just want to thank @Steffen Heller  and his post above on July 27, 2018 for helping me understand this.  I came here frustrated like others but found the answer in his replies.

 

I created an anchor called #bottom which I added to the bottom of my wiki page.

I attempted to test it using this URL

https://wiki.RRR.edu/confluence/display/HMDC/IQSS+Engineering+Reporting#bottom.

That did not help. I got frustrated. I read the post. I then tried.

https://wiki.RRR.edu/confluence/display/HMDC/IQSS+Engineering+Reporting#IQSSEngineeringReporting-bottom

 

This worked. Now I understand.

Thanks

Like Steffen Heller likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events