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

How to link to an anchor on the page?

Shivansh Singh September 15, 2011

I have created an anchor on a page as follows

{anchor:here}

But I am unable to link to the above anchor. I am using Confluence 3.4.8. When I write the following markup in the rich text editor it displays the text as-is rather than showing it as a link to anchor.

[#here]

Am I missing something?

5 answers

3 votes
NikolayS September 27, 2018

I tried to repeat steps from Atlassian Achors tutorial, but confluence could not find my anchors (strange). This video helped me to make links to anchors work.

Briefly:

  • create an anchor with name "anchorname"
  • show "Insert link" popup -> Advanced tag -> in Link field enter "#anchorname" (without quotes). Save link, save draft.
0 votes
pasquale.gagliano September 24, 2020

I had a need to add a link to a paragraph in the same page; to do so I have added a Table of Content that has generated all the links to all headings in the page. Then where I needed to add the link I have simply added the link as per ToC

0 votes
James Brown February 1, 2019

I just wasted hours trying to do this. I added the anchor macro to the bottom of a page and gave it the name Bookmark.
I navigated to another page in a different space and inserted a link using the advanced option. I entered IHopeThisWorks as the link text followed by spacekey:pagename#Bookmark (obiviously using the actual space key and page name and it did not work.
Is there an issue when using special characters in a page name?

BlueberryCake March 14, 2019

I don't think there is an issue with special characters in this regard only. Just tried the following: Inserting an HTML link via code editor as <a name="anchorname">xxx</a> and it won't work , too. The tags are deleted while being parsed, creating a blank output of "xxxx"  I checked the code, there are no tags anymore an dlinking doesn't work. This means it wouldn't be possible to set alink to an achor from outside the system at all. *sad*

Never use capitals or special chracters in identifier's or variable's names.

I just discovered the following workaround:

 

Link to a heading on a page

Choose Link > Advanced then enter the heading in one of the formats below. Heading text is case sensitive and must be entered without spaces.

  • For a heading on this page: #MyHeading.

https://confluence.atlassian.com/confcloud/insert-links-and-anchors-724764900.html

BlueberryCake March 14, 2019

But in order to answer your question: Never use special characters or capitals when naming variables or identifiers

BlueberryCake March 14, 2019

Sorry for crossposting my own comments. Found a solution to link from outside. It's a little bit crude: Confluence uses the following syntax when it comes to anchor linking: http://domain.com/display/SPACESHORTCUT/pagename#pagename-anchorname

Like Mario Murphy likes this
Jon Wilkins May 1, 2019

I've also spent hours (if not days) trying to get linking to Confluence page anchors from external pages (including in some cases, ironically, Jira tickets) and the above info finally solved most cases for me.

However, I've figured out some nuances that are worth adding here to save others' time:

Using the basic structure above:

http://domain.com/display/SPACESHORTCUT/pagename#pagename-anchorname

1) Page titles with punctuation (specifically brackets "(" & ")" but may include others:

The punctuation marks are
- removed from the pagename in the URL path (left of the #)
- retained in the pagename in the URL fragment (right of the #)

example 

For a page title "This & That" with anchor "001", the link would be

http://domain.com/display/SPACESHORTCUT/This+That#This&That-001

2) Page titles that start with a number:

The pagename in the URL fragment seems to get prefixed with "id-"

e.g For a page title "1 Guide" with anchor "001", the link would be

http://domain.com/display/SPACESHORTCUT/1+Guide#id-1Guide-001

Like # people like this
Danny Oliva February 13, 2020

@Jon Wilkinsthanks Jon!  your examples helped me out a TON!

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 15, 2011

Firstly, as Kevin says, you can't type anchor links like that directly into the Rich Text editor using wiki markup syntax - you should either swap to the wiki markup editor, or use the "link browser" dialog in the Rich Text editor to type in the link.

Secondly, I'm fairly certain you need to include the page title in the link, in addition to the name of the anchor, so try:

[PageTitle#anchorName]

Shivansh Singh September 26, 2011

To link to an anchor I followed following steps: -

1. In the rich text editor edit mode, pressed Ctrl+K to open link browser.

2. Typed the page name. As I started typing the page name confluence automatically lists the page names which inlucde that keywork which I am typing.

3. After entering page name I added anchor name like this - Home#Overview

4. Saved the page.

When I click on the link, it navigates me to the top of the Home page and not the Overview segment of the page. I check the wiki markup of the page for the link and it is as follows:

[Overview|MySpace:Home]

Above markup is in the form: -

[<Link text>|<space name>:<Page title>]

It doesn't include the anchor name, even when I specified the anchor name at the time of specifying the link in the link browser. When I modify the above markup in the "wiki markup" view as below it works fine.

[Overview|MySpace:Home#Overview]

So, it seems to me that there is some bug in Confluence. When we give anchor name from link browser it doesn't include it in the markup, but when I explicitly mention the anchor name in the "wiki markup" view, it works absolutely fine.

Kevin Buchs
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.
September 26, 2011

I think this is beyond the scope of the rich text editor in Confluence versions < 4.0. It is most reliably done in Wiki markup.

Shivansh Singh September 26, 2011

Is it the problem with ver. < 4.0? How about ver. 4.0 or greater?

Kevin Buchs
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.
September 26, 2011

Everything related to such problems changes in 4.0 and such problems are excluded by design. It is a whole new editor.

0 votes
Kevin Buchs
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.
September 15, 2011

You cannot simply past the markup in the Rich Text editor. You need to select the "Insert Macro" tool bar button (looks like a little scroll), choose the Anchor macro and then enter your anchor label as the target, with # preceeding. Then I believe the best choice is to insert your hyperlink using the Link macro.

Shivansh Singh September 15, 2011

My anchor has been created properly because when I save page and see the view it doesn't shows the anchor tag.

But the problem is I am not able to link to the anchor I have created. When I write [#here], it displays the text as is with "#" symbol.

Kevin Buchs
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.
September 15, 2011

Go ahead and paste the Wiki markup for your page here. We can probably explain it better that way.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events