Documentation for Confluence 5.4.
Documentation for Confluence OnDemand and earlier versions of Confluence is available too.

Skip to end of metadata
Go to start of metadata

Anchors are used to enable links to a specific location on a page. Anchor links can be especially useful when navigating between sections of a long document, or when you want to link to a segment of a page instead of the top of the page.

Anchors are invisible to the reader when the page is displayed.

There are two steps to using an anchor:

  1. Create an anchor on the page.
  2. Create a link to the anchor.

Creating an anchor

Use the Anchor macro to mark the location you want to link to.

  1. Add the Anchor macro to a page.
    1. In the Confluence editor, choose Insert > Other Macros.
    2. Find and select the required macro.

    Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Using Autocomplete.

    To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

  2. Specify the name of your anchor. For example, 'bottom' or 'important information'. See the 'Anchor Name' parameter described below.

On this page:

Related pages:

Macro options (parameters)

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Parameter

Default

Description

Anchor Name

None

This is the anchor name that you will use when creating the link.

  • The anchor name can include spaces. Confluence will remove the spaces automatically when building a URL that points to this anchor.
  • The anchor name is case sensitive. You must use the same pattern of upper and lower case letters when creating the link as you used when creating the Anchor macro.

Creating a link to an anchor

You can link to an anchor from:

  • A page on the same Confluence site. The link may be on the same page as the anchor, another page in the same space, or a page in another space on the same Confluence site.
  • Another web page or another Confluence site, using a specifically formatted URL.

To link to an anchor from within the same Confluence site:

  1. Select some text or position your cursor where you want to insert the link.
  2. Choose Link on the toolbar or press Ctrl+K.
  3. Choose Advanced and enter the anchor name in the Link field following the format below.

    Anchor locationLink syntax for anchorExamples
    Same page#anchor name

    #bottom

    #important information

    Page in same spacepage name#anchor name

    My page#bottom

    My page#important information

    Page in different spacespacekey:page name#anchor name

    DOC:My page#bottom

    DOC:My page#important information

    The anchor name is case sensitive. You must use the same pattern of upper and lower case letters as you used when creating the Anchor macro. 

  4. Enter or modify the Link Text - this is the text that will appear on the page. If this field is left blank, the page name or URL will be used as the link text..
  5. Choose Insert.

Screenshot: The 'Advanced' option in the link dialog

To 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. You must use the same pattern of upper and lower case letters as you used when creating the Anchor macro.

Notes

  • Table of contents on page: Consider using the Table of Contents Macro to generate a list of links pointing to the headings on the page. The list of links will appear on the page, and will be automatically updated each time someone changes the wording of a heading.
  • Linking to headings: You can link directly to the headings of a page. See Working with Links. However, if someone changes the wording of a heading, those direct links will be broken. Use the Anchor macro to ensure a lasting link within the body of a page.
  • Site welcome message: If you are adding an anchor to a page that you are using in the site welcome message, you can only link to that anchor from another page. Internal links within that page will not work.
  • Templates: When you are previewing a template, a link to an anchor is displayed as a 'broken' link. However, when you create a page using the template the resulting page will have the correct link.

63 Comments

  1. In confluence 4.2, if you a add a link to an anchor using \[#anchor name\], it renders as #anchor name.

    In previous version the link text would not have the #, which is correct.

  2. Anonymous

    I have a similar issue. When I create the link to the anchor (which is near the bottom of a long page), the link brings me to the first topic on the page, which is incorrect. There's no anchor on this topic, so I can't figure out why it's going there instead of the anchored text. 

    1. Anonymous

      Update: it's not going to the topic but is directing to the TOC macro, where the heading appears. This is not correct; I want it to link directly to the bottom of my lengthy page, where the topic actually is. 

      1. I'm experiencing this issue as well.  Anyone have a solution?

        1. Hi all. I wasn't able to reproduce this on Confluence 4.3, so I'd recommend raising an issue in https://support.atlassian.com so we can investigate it with you. In future if you're having trouble that's the best place to start - these comments aren't usually monitored, so you'll get a much quicker response going through the support channel.

          1. Has this been resolved? I can't find anything on the support site about this, but I am having the same issue in 4.3.

            Thanks.

            1. Anonymous

              I got the same issue on 4.3.2, it jumps to the TOC entry.

              1. Anonymous

                I've got the same issue on 4.3.7.

                1. Anonymous

                  I think this happens, if you manually place an anchor in the headline. Then the anchor will appear in the TOC, so the link will jump to the first anchor, which is the TOC.

                  Instead just use the headline as a link, since anchors are automatically created for headlines.

                  Example: #My first headline

                  (You can keep the spaces as spaces)

                  1. Anonymous

                    This fix worked for me. 

                    1. Anonymous

                      If you want to use an anchor to prevent link breakage, put the anchor directly above the heading and ensure it's set to "paragraph." This works great for me.

  3. Anonymous

    How about linking to a page with an id?

    1. If the page is showing an ID because of a special character in the URL, do the same as described above in "Creating a link to an anchor," except url encode the special character in the anchor name.

      Page title: This & That
      Anchor name: foo
      Link

      https://sitename.com/pages/viewpage.action?pageId=15003344#This%26That-foo

      Not sure if it's supported, but it seems to work. (smile) 

  4. Can you make the TOC move with you as you scroll down the page?

  5. Anonymous

    How to create a link to an anchor when pagename has a colon (:) in its name? Example:

    Following page title "First step: buy food" is incorrectly recognized as "spacekey: pagename" and because the First step space doesn't exist I can't make a link to an anchor.

    What if the name of the page containing the anchor will be changed? Will link be updated as well (automatically)?

    Regards,
    Michal

  6. Anonymous

    I need to find out if there are links to a given anchor.

    (reason: I need to check if an anchor can be deleted)

    Is that possible?

    THX and regards

  7. I have trouble using the anchor macro to create a "Return to top" link. 

    I insert the anchor "Top" in the very beginning of my page (I tried both the wiki markup and inserting the ready-made anchor macro). Then I make a link to this anchor by going to Insert > Link > Advanced. I enter #Top in the "link" field. After saving the page and testing, my Return to Top link takes me away from my page and to the Homepage of confluence!  I just can't find what I'm doing wrong...

    Thanks for helping out.

  8. Anonymous

    #Top didn't work for me either.  I gave it a more unique name #ExportTop and that worked.

    Process Defined:

    1. Insert > Other Macros > Anchor
    2. Name uniquely MyAnchor (Copy This)
    3. Insert
    4. Highlight text to be link
    5. Click 'Link' and enter # and paste.
    6. Save
    1. Where did you inserted the anchor?

      It seems that it is not possible to insert it at the headline.

      So a "back to top" button will online go short befor the top.

      Did anybody have a solution therefor?

      Cheers, Chris

  9. Anonymous

    I would like to use an existing id in the confluence page html frame to realize a "Top" link.
    If I try to use an existing id like "content" or "page-metadata-end" confluence starts it's usual "i have to calculate titel and anchor" and the link goes to nowhere.
    Any ideas, how to use "#content" or sth. without confluence changing the link code?!
    Thx!
    Matze 

  10. Anonymous

    I was struggling with Anchors quite a bit till I tried using the Advanced Link tool rather than the basic page link. Then they worked fine.

  11. Anonymous

    Can someone direct me to where the Advanced Link tool is? I can't identify where that is, and that is why I can't make use of the anchors.

    1. Hallo Anonymous

      The 'Advanced' option is a tab on the 'Insert Link' dialog. I've added a screenshot to the page, to make it clearer. Here's the screenshot:

      If your Confluence site doesn't include the 'Advanced' tab in the dialog, then you may need to upgrade to a later version.

      Cheers

      Sarah

       

  12. Anonymous

    Yes – I do not see the "Advanced" tab in the Link menu. Upon further investigation, it seems as if our company is using Confluence 3.5.17. If you know of how it would be done in this version, it'd be great to be pointed in that direction.

    Thank you for pointing that out!

    1. Hallo there

      Ah, Confluence 3.5. (smile) You can use wiki markup to link to an anchor. The documentation is here: https://confluence.atlassian.com/display/CONF35/Working+with+Anchors

      Cheers, Sarah

  13. Anonymous

    Hi there,

    I am working with decks and cloaks to sort information and avoid numerous sub-pages. I am experiencing though that anchors do not work within decks. I expected that the respective "tab (of the deck)" opens when I link to an anchor in the content. Yet it always directs to the first tab. Is there a workaround or other possibility to direct to different tabs?


    Thanks for your support!

    1. Anonymous

      Yes. This can be done. Use the {show-card} macro to create a link to a specific card in a deck.

      I am not happy. I am really not happy. To answer your question I just edited a new page using the Confluence Editor which had a solution which could really help. THE EDITOR KILLED 20 MINUTES OF MY WORK. I have no answer now. I feel terrible. I wrote this up in a page and now it is gone. Just gone. I can't copy it out somewhere else BECAUSE IT IS IN THE CONFLUENCE EDITOR !$^!@$ AND NOT IN WIKI MARKUP.

      So. It's gone. I have just wasted my time. This is not the first time this has happened. I would be editing a page. I look at the page and think 'it's okay, when I click save it will be there if something stuffs up'. NO. IT ISN'T. Stupid editor. Damn stupid editor. Not only does it get in my way, reduce my content to only that which is headings and paragraphs under headings (heaven help you if you put macros on the page because the outcome is a page full of boxes taking up the whole screen in a huge mess) but it just destroys my hard work. My work. My time.

      There must be a better way. I am tired of creating brand new content and then having it destroyed.

      I could really help you but atlassian's editor is making my life hell. So, I give up. Sorry. I am just depressed.

  14. Anonymous

    Hello,

    I'm having an issue where anchors do not work when using the 'Include Page' macro on another Space.  When clicking the anchor link, the page does not goto the specified spot, however on the original page it works.  Any thoughts?

     

    Thank You in Advanced.

  15. Anonymous

    What do we do if our anchor looks like this? Widget+Documentation#WidgetDocumentation-<CollectionOperation> I can't seem to get it to work becuase it keeps complaining about the "<" and ">" in the link name. If this is an issue, why does Confluence allow for that link to be created in the first place?

  16. Is it possible to anchor the Confluence header throughout spaces in Confluence?

  17. Hi Atlassian, I would like to ask you what are the reasons for the anchor name to be changed as described above, e.g. #pagename-anchorname, instead just #anchorname? Also is there any way to configure this? Please elaborate the reasons, because we want to create our own macro that wouldn't add prefix to the anchor name, so we would like to know if there is any good reason why there should be a prefix?
    Thanks 

    1. I am talking about external links. (smile)

  18. Anonymous

    Why in the world does confluence add the page name to the resulting anchor? If I create an anchor 'foo', I want to be able to link to that page (from an external page, site whatever) with '<Page-URL>#foo'. This is why I named the anchor 'foo' in the first place!

    And even worse: Renaming the page actually changes the anchor! (So my 'stable' external link to the Wiki with '...?pageId=74580125#foo' breaks).

    1. Anonymous

      Sorry for the duplicate. Had a timeout the first time and hit the send button again a few hours later...

      1. Thanks Anonymous, I've removed the first duplicate. I'm sorry about the frustrating link format. There's an issue on our issue tracker, where you can vote and comment, and watch for progress: CONF-5833 - Use shorter anchor names in HTML rendering mode Resolved

        Cheers

        Sarah

  19. Anonymous

    Sorry I dont think I have a clear response to the post about the anchor not directing to the specific section where the anchor is located.   I am trying to use the anchor macro vreating a link from one page to another on the same site using syntax format page name#anchor name. after saving if I click the link it does not take me to the specific section where I have added the anchor, I still need to scroll down to find the section I intend to go. Please respond as soon as possible.

  20. Dear All,

    I prepare a globale template with summary and anchor to refer to a part of procedure.

    When I try to add hyperlink with anchor, I receive error message "Internal server error".

    Can I use hyperlink & anchor in a global template?

    Do you have a solution?

     

    Thank you for your help

     

    Cedric DEVAUX

  21. Anonymous

    This is really useful. I didn't know <a href="http://swc.bc.ca/services">bc anchors</a> could be so useful. I'm going to start using them.

  22. Anonymous

    Hi there,

    In the Creating a link to an anchor section (above), the content in the Link syntax for anchor section is incorrect.

    The equivalent content in the documentation for Confluence 5.1 was correct. Could you please update this content above?

  23. From JIRA can I link to a page anchor?

    1. To link from JIRA to a Confluence page, you need the full URL.  This works for anchors too.

      The hard part is getting the URL with the anchor. 

      If your purpose is to link to a section heading on the page, the anchors are already there. One trick I use is to add a toc to the Confluence page.  Then you can right-click on the link to the section in the TOC, and Copy Link Location.  Now you have a URL you can paste into your JIRA page.

  24. Is there a way, when entering wiki markup, to display an anchor without the '#' sign in front? I've tried both:

    [#anchor|anchor] 
    and
    [#anchor:anchor]

    with unsuccessful results.

    1. what about

      [anchor link text|#anchor]

      Just a friendly reminder. For this kind of questions, the best site to get them solved fast is in Atlassian Answers.

  25. Has the following bug been posted?

    1. Use the Advanced method to add the link to (say) SPKEY:Another Page#hereiam
    2. Save page. Anchor works.
    3. Edit the page again, and click on the link to edit it.
    4. Advanced window appears, and link says Another Page#hereiam (i.e. it loses the space-key).
    5. If you save from the Link Edit window (without changing anything), you've now broken the link.

    (Using Confluence 5.1.3.)

    1. Anonymous

      Yeah, that's like the problem I'm having as well.

      Adam

    2. CONF-28087 - Space key is missing when editing links to anchors on other pages Open

  26. Found the JIRA ticket for this exact problem.

    CONF-28087 - Space key is missing when editing links to anchors on other pages Open

    I voted for it ... others should too if they run into this problem.  It's an annoying one because it makes it really easy to break a link, and then you have to start over.

     

  27. Anonymous

    I've added anchors and then link to them from another page. The page with the target anchors is quite long and anchors are in cells in a table. The links to them use the format Page name#AnchorName. Note that the page name has a space in it, so I am including that. When I click the links, the target page does not open to the anchor location. It is always off a bit. I have to scroll up or down to find the item associated with the anchor.

    Does anyone have ideas about why this is happening?

    Thanks.

  28. It appears that this functionality is completely broken in 5.2.2. We recently upgraded, and I was able to add anchors in 5.1.2, but now when I create an anchor in a page and then try to link to it in the same page using Advanced Link as described in the document above, the link is added but does not work when you click on it. When I hover my mouse over the link, the URL shows the anchor as #page_title-AnchorName, but it doesn't take you to the spot in the page where I created Anchor Name.

  29. I'm having the same problem. My anchors that I created in a previous version still work but if I try to create a new anchor it will not take me to the page location but just to the top of the page.  We're on On Demand Confluence 5.2 and JIRA 6.1.

  30. Hi Melissa LanningMelody Bliss

    I've tried to reproduced the issue without success, it might be some special issue happen on your instance, can you please create support ticket so that we can help you to fix the issue? 

    Thanks 

    MOMO

  31. Anonymous

    My mistake, we are on Confiuence 5.1.5. I will log a ticket for this, though.

  32. Is it jus me or is the Anchor tag not working in Confluence 5.0. When I try to create an anchor on the same page it doesnt work.

    The content in the examples above are wrong.

  33. Anonymous

    Can we add an anchors into a template and be able to link to it within the page?  For instance, I want to create a link in my page template that sends me back to the top of my page. 

  34. It's not just you.  I just upgraded to 5.3 and can no longer create an anchor link.  Atlassian . . . Help!

    1. It seems to be a bug:  CONF-31139 - Not a Recognised Space Error When Creating Anchor Link Needs Verification

  35. Has this been fixed? Cannot add link and anchor to a page, in version 5.1.

    Thanks

  36. What I've found, believe it or not, is that it sometimes (but not always) works if you define short anchors–two characters or so. 

    1. Thanks! Unfortunately your tip did not work for me–I tried 2 and even 1 character anchor names. My experience has been somewhat similar to yours in that in general the whole anchor/link functionality is quite erratic–sometimes it works, sometimes it doesn't....

      Thanks again

       

  37. Anonymous

    How can I list all anchors on a page?

  38. It would be great that if the anchor is in an expand section that when the link is clicked on the expand is automatically opened. Please vote for the issue CONF-27357

  39. Could you perhaps consider making this usable? I had access to better anchor manipulation tools in 1995. How about a toolbar button for inserting an anchor? How about a choice in the create link dialog box that doesn't require hand surgery?

    1. Hi Alex, I agree. I'm afraid, its a bit of a pain point for us tech writers too.  If you haven't already done so, comment or vote on this ticket   CONF-25533 - Provide a nicer way to link to page anchors Open