This documentation relates to Confluence 3.1.x
If you are using an earlier version, please view the previous versions of the Confluence documentation and select the relevant version.

Working with Anchors


The Anchor Macro allows you to link to specific parts of 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 and not to the page as a whole.

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

Anchors are made up of two parts:

  • The link
  • The content to which you are linking.

On this page:

Usage with the Macro Browser

To insert the anchor macro into a page using the Macro Browser,

  1. Open your desired Confluence page or blog post, then click the 'Edit' button. The page or blog post opens in edit mode.
  2. Click the Macro Browser icon on the toolbar. The macro browser window opens in the middle of the screen in 'macro selection' mode.
  3. Scroll through the list of macros. Alternatively, start typing part of the name of your desired macro into the search box at the top right of the macro browser window. Macros with a matching name will appear in the main pane.
  4. Click on the desired macro to access its parameters and preview parameter changes ('preview mode').
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to put the macro into the page.

Once you've found the anchor macro, click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

The following code creates an anchor called "here", but you can substitute this with whatever name you like.

{anchor:here}

Once an anchor is in the page, you can link to it by putting #here (or whatever anchor name you choose) at the end of a link pointing to that page.

Parameters

Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).

Parameter Default Description
Anchor Name
(anchor)
None; name must be supplied This is the name of the anchor that you will link to.

Examples

In the next example, there are two anchors in this page called "top" and "bottom", which you can link to like so:

[#top]
[#bottom]

These links come out like this: top bottom.

More examples follow.


Linking to an anchor in the same page

[#anchorname]

Linking to an anchor in another page

[nameofpage#anchorname]

Linking to an anchor in a page in another space

[spacekey:nameofpage#anchorname]

Linking to headings

Confluence treats all headings as anchors. So you don't have to place an anchor but simply link to it like this:

[#textofheading]

Warning
Page titles and links to other spaces can be combined with anchors and attachments, but you can't use attachments and anchors in the same link.

Note that if you are adding an anchor to the site welcome message, it must be to another page. Internal-only links such as {anchor:bottom} will not render.

RELATED TOPICS

Working with Links Overview

Take me back to the Confluence User's Guide.

Labels

macro macro Delete
anchor anchor Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 04, 2007

    Anonymous says:

    I need to link to an anchor from outside Confluence.  What's the URL for th...

    I need to link to an anchor from outside Confluence.  What's the URL for that?  I've tried page#anchorname without success.

    1. Dec 04, 2007

      Choy Li Tham says:

      Hi, I presume you want to link an anchor in the page outside from Confluence. I...

      Hi,

      I presume you want to link an anchor in the page outside from Confluence. If this is the case, you may want to use the page URL address instead of using the page name. An example would be:

      [alias|<URL of external page>#anchorname]
      

      Regards,
      Choy Li

      1. Dec 06, 2007

        Anonymous says:

        Thanks for your reply.  However, what you suggested is what I had tried - I...

        Thanks for your reply.  However, what you suggested is what I had tried - I guess I wasn't clear about that.

         I have found that this works:

        [alias|UBaseURL/namespace/page#page-anchor]
        
        &nbsp;
        
        I have no idea why the redundant page is needed between the # and the \-, but JSPWiki requires the same sort of syntax, so there is precedent.
        
        1. Dec 06, 2007

          Kelly Roney says:

          No longer anonymous... Sorry about the extra boxes above.

          No longer anonymous...

          Sorry about the extra boxes above.

  2. Feb 13, 2008

    Anonymous says:

    Hi,     In the opposite direction to the post above, was wonderi...

    Hi,

        In the opposite direction to the post above, was wondering what the syntax might be to address an anchor (inside a confluence space/page) via a link (email etc.) from the outside.

        I have made a (failed) attempt by appending #table_anchor to  the 'tiny' link from the page's info tab. It looks something like tiny_link#table_anchor.

        When clicking on the link from an email message, the page opens but does not advance to the anchor.

        Any thoughts would be appreciated.

    Thanks in advance,

        Derek B. 

       
     

      
     

    1. Feb 14, 2008

      Ming Giet Chong says:

      Hi, The following link is an example of linking to an anchor of a page: http...

      Hi,

      The following link is an example of linking to an anchor of a page:

      If you need any further technical assistance for this issue, I would suggest you to raise a support ticket at:

      Regards,
      MG

    2. Feb 28, 2008

      Anonymous says:

      I'd be interested in this too - it seems like there should be some kind of a uni...

      I'd be interested in this too - it seems like there should be some kind of a unique page ID that you should be able to look up and use per page to form the syntax something like <siteIDorURL><ParentPageID><childPageID><AnchorName>.  My concern is that any link that is dependent on the name value used in the left-hand button/tab navigation will not be as stable long-term to link to as a url based upon a key or unique ID value.. but I have been unable to locate more than the "tiny link" value in the info or edit of a page.  It seems like there must be a key value assigned, because some pages display a numeric identifier at the end of the url, but I'm not sure what the logic is whereby this gets used in the url - I can't figure out how to get it for some of the sub-pages.

      If anyone has any insights for locating this +/or samples for how to form this successfully using something more able to weather change than the name value, I'd much appreciate your insights!

      Monica 

  3. May 28, 2008

    Anonymous says:

    I am playing with the evaluation version to see if this is what our company need...

    I am playing with the evaluation version to see if this is what our company needs. I tried placing 2 anchors on the same page, like the top and bottom example above.

    On the first one, the link was on the top of the page, and it worked beautifully leading me to the bottom of the page where the anchor was.

    Then I tried doing the opposite: placing an anchor on the top of the page, and the link at the bottom. I cannot get this to work, even though the syntax is correct. Actually, on the top I have "Upload .", but when I save and view all that shows up is "Upload ." 

    Any idea what is going on here?

    Thank you!

     Marta

    1. Jun 02, 2008

      Ming Giet Chong says:

      Hi Marta, I would suggest you to raise a support ticket at https://support.atla...

      Hi Marta,

      I would suggest you to raise a support ticket at https://support.atlassian.com to further investigate to this issue. Please provide the wiki markup for this issue. Thanks.

      Regards,
      MG

  4. Jul 08, 2008

    Anonymous says:

    I cannot get an anchor to work within a table. The link is from outside of the t...

    I cannot get an anchor to work within a table. The link is from outside of the table, and the anchor itself is within the table. When I click on the link to jump to the anchor, nothing happens. Is there any way around this?

    1. Jul 09, 2008

      Azwandi Mohd Aris [Atlassian] says:

      Hi there, Unfortunately, I cannot reproduce the problem on my local instance. T...

      Hi there,

      Unfortunately, I cannot reproduce the problem on my local instance. The anchor seems to work fine when included within a table. Please try the following wiki markup:

      Link to content within [#table]
      ||heading 1||heading 2||heading 3||
      |cell A1|cell A2|cell A3|
      |cell B1|cell B2
      \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ 
      \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ 
      \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
      \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
      \\ \\ \\ \\ \\ \\ \\ \\ \\ \\
      {anchor:table}Your content|cell B3|
      

      Please note that in the above example, I have to make sure that the page is scrollable, so that I could see the effect of the anchor link.

      However, if the problem still persists, please raise a support request at http://support.atlassian.com

      Cheers,
      Azwandi

  5. Jul 22, 2008

    Margaret Ostrander says:

    I've been trying to figure out a way to use an IMAGE as an ANCHOR link to anothe...

    I've been trying to figure out a way to use an IMAGE as an ANCHOR link to another location on the same page without using the default styling of the text.
    Is there a way to do this?

    1. Jul 24, 2008

      Azwandi Mohd Aris [Atlassian] says:

      Hi Margaret, To my understanding, you can try to use the following notation: ...

      Hi Margaret,

      To my understanding, you can try to use the following notation:

       [!YOUR_IMAGE.jpg!|#ANCHOR_NAME] 

      Hope this helps. Feel free to clarify if I have misinterpreted your question.

      Cheers,
      Azwandi

      1. Jul 28, 2008

        Margaret Ostrander says:

        Thanks Azwandi! The issue is that we're having some odd linking issues in ge...

        Thanks Azwandi! The issue is that we're having some odd linking issues in general when using the Rich Text editor. Using the wiki code straight away solves the problem. A simple solution that I did not see staring me in the face earlier. Your help is much appreciated!

  6. Jul 22, 2008

    Anonymous says:

    I am trying to use a heading as an anchor. to do this i am doing something like ...

    I am trying to use a heading as an anchor. to do this i am doing something like this (with various combinations), but nothing seems to work

    OR

     any help is appreciated.

    1. Jul 23, 2008

      Azwandi Mohd Aris [Atlassian] says:

      Hi there, You might want to try the following to set an anchor to headers: ...

      Hi there,

      You might want to try the following to set an anchor to headers:

      {anchor:my_anchor_name} h3. My Header
      

      Hope this helps.

      Cheers,
      Azwandi

  7. Dec 20, 2008

    Anonymous says:

    Hi, I am trying to link to a specific word in a glossary. I use [pagetitle#ancho...

    Hi, I am trying to link to a specific word in a glossary. I use [pagetitle#anchor] but when you click on it, you get sent to the anchor for a split second and then you get shunted up to the top of the glossary page. Any ideas?

    Emily

    1. Jan 05, 2009

      Azwandi Mohd Aris [Atlassian] says:

      Hi Emily, I have never encountered such problem, but does it happen to other pa...

      Hi Emily,

      I have never encountered such problem, but does it happen to other pages that have anchors? Can you please check if the URL of the page is valid? What about other browsers? It might be a local issue (unrelated to Confluence) too; can you please check if this page exhibits the same problem: http://www.w3schools.com/css/css_reference.asp#pseudoel

      1. Feb 18, 2009

        Cedric Blum says:

        Hi, I'm having the same probleme using firefox or IE7,and the link provided ba...

        Hi,

        I'm having the same probleme using firefox or IE7,and the link provided bay Aris Mohd works...

        what is strange is that the url "http://casimir.bo.virginmobile.fr/display/BAS/contenu+flottant#contenuflottant-ancre" is working when i clik on it again when the page has loaded.

        any ideas? should i open an issue on JIRA?

        Thx

        1. Feb 25, 2009

          Azwandi Mohd Aris [Atlassian] says:

          Hi Cedric, Apologies that I could not really understand your scenario. Would it...

          Hi Cedric,

          Apologies that I could not really understand your scenario. Would it be possible to provide some detailed steps to reproduce this?

          Cheers,
          Azwandi

      2. May 04, 2009

        Anonymous says:

        Thanks, Azwandi. You're right, in IE it works just fine, but it won't work in Fi...

        Thanks, Azwandi. You're right, in IE it works just fine, but it won't work in Firefox. Any ideas on getting it to work in Firefox? Thanks!

        -Emily

        1. May 06, 2009

          Azwandi Mohd Aris [Atlassian] says:

          Hi, Emily. Just to ensure that this is a Confluence-specific issue, does this li...

          Hi, Emily. Just to ensure that this is a Confluence-specific issue, does this link work for you in both IE and Firefox? You might want to try on other Firefox or even better, test it on a separate, fresh Firefox profile to get rid of custom add-ons and settings.

          1. Aug 20, 2009

            Jon Crutchfield says:

            I can replicate this problem for some anchors in Firefox on Windows and Firefox ...

            I can replicate this problem for some anchors in Firefox on Windows and Firefox and Safari on Mac. The problematic anchor works in IE 8.

  8. Feb 04, 2009

    Brian Carr says:

    Has there ever been any consideration to add an "anchor index" macro that would ...

    Has there ever been any consideration to add an "anchor index" macro that would automatically list all of the anchors on a page? For instance, let's say that I have a page with 4 anchors:

    {anchor:A} Text A
    {anchor:B} Text B
    {anchor:C} Text C
    {anchor:D} Text D
    

    It would be nice to be able to have add something like this to the top of the page:

    {panel}
    {anchor-index}
    {panel}
    

    And it would return actually present the following:

    A
    B
    C
    D

    Text A
    Text B
    Text C
    Text D

    Hopefully this makes sense. Really what I am looking for is something more a long the lines of what mediawiki users are accustomed to using. I think they call them "sections". But basically it allows you (for long documents) to automatically create an index (or TOC) at the top of the page (based on the sections that you create throughout the document). Or is it possible to do this using something other than anchors?

    Thanks!

    1. Feb 05, 2009

      Komathi Krishnan [Atlassian] says:

      Hi Brian, You can use the {toc} macro in order to achieve this. Make sure you h...

      Hi Brian,

      You can use the {toc} macro in order to achieve this. Make sure you have the bundled Table of Contents Plugin installed and enabled in your Confluence. And then use the {toc} macro to extract all the headings to the top of the page. I have attached a link for you to refer on how to use this macro, look under Confluence Content section:

      Cheers,
      Komathi

  9. Apr 09, 2009

    eric boudet says:

    I want to set a link to an anchor in a page with cards. It doesn't work. When cl...

    I want to set a link to an anchor in a page with cards. It doesn't work. When clinking on the link i'm sent to the top of the first card of the page not to the targetted anchor.

    Is there a special syntax in the anchor definition to take into account the decks and cards ?

    Thanks for your answer

    1. Jun 18, 2009

      Sashidaran Jayaraman [Atlassian] says:

      Hi Eric, The composition plugin is a 3rd party plugin and is not supported by A...

      Hi Eric,

      The composition plugin is a 3rd party plugin and is not supported by Atlassian. I would suggest you to comment on their plugin page to get a better response for this issue.

      Cheers
      JSashi

  10. Apr 23, 2009

    Anonymous says:

    Oops. Sorry for the bad post. Fat moused. My bad. Corrected post. New user. I ...

    Oops. Sorry for the bad post. Fat moused. My bad.

    Corrected post.

    New user. I must be reading this wrong. Looking for a simple link on the same page. Example:

    text asdfljasdl fasdf asdfasdf asdfasdfa  asdfdfadf.

    sadfasdf want to [link to instructions#begininst]  about how to do something. fsdfsfsdfa.

    asdfa adf fasdfadf fasdf asdf fsda.

    Further down the page, instructions.

    blah blah blah

    and on and on

    This links to a new page instead of the 'begininst' anchor further down. What am I doing wrong?

    Thanks in advance, Jim

    1. Jun 22, 2009

      Sashidaran Jayaraman [Atlassian] says:

      Hi Jim, Your markup should look like this: window.SyntaxHighlighter.config....

      Hi Jim,

      Your markup should look like this:

      [link to instructions | #begininst] 
      

      instead of this:

      [link to instructions#begininst] 
      

      notice the | symbol.

      Hope this helps.

      Cheers
      JSashi

  11. Apr 23, 2009

    Anonymous says:

    Well maybe not. There is an anchor tag right above the text 'this links to a...'...

    Well maybe not. There is an anchor tag right above the text 'this links to a...' line. Didn't show up in the post.

    Now I'm feeling more fustrated. And it's only Thursday.

    1. Apr 24, 2009

      Azwandi Mohd Aris [Atlassian] says:

      Hi Jim, Sorry that I could not really understand what you are trying to ask. Pe...

      Hi Jim,

      Sorry that I could not really understand what you are trying to ask. Perhaps, you can repost the question, but wrap it within a {noformat} macro:

      {noformat}
      contents, anchors, bla bla bla
      {noformat}
      

      Cheers,
      Azwandi

  12. Jun 01, 2009

    Anonymous says:

    Hi I need help in using anchors. I was able to get anchor tag working but the a...

    Hi
    I need help in using anchors.
    I was able to get anchor tag working but the anchor element generated is of the format
    <a name="

    Unknown macro: {Page Name}

    -

    Unknown macro: {Anchor Name}

    "></a>
    Can you pl let me know how i can use anchor macro such that it does not add page name to the anchor tag (html)?

  13. Jul 15, 2009

    Karal Gregory says:

    Using links to a header on a different page from within the same space does not ...

    Using links to a header on a different page from within the same space does not appear to be working at all. Even making an anchor above the header and using it does not work. The link merely goes to the top of the page where the header (or anchor) resides instead of to the location on the page. I've used IE 7 and Firefox and get the same result. Can you please let me know what to do? thanks!

    1. Jul 17, 2009

      Paul Schacht says:

      I'm having the same problem. Firefox 3.5.

      I'm having the same problem. Firefox 3.5.

      1. Aug 19, 2009

        Sashidaran Jayaraman [Atlassian] says:

        Hi guys, I have tried this in both Firefox and Internet Explorer, but I am able...

        Hi guys,

        I have tried this in both Firefox and Internet Explorer, but I am able to get it to work as expected. Perhaps the page that you are linking to is lacking of contents which makes it difficult to notice the effect. Just to test it out, you might want to create the following wiki markup in two pages:

        First Page
        {anchor:first}
        h1. First Title
        {loremipsum:10}
        {anchor:second}
        h1. Second Title
        {loremipsum:10}
        {anchor:third}
        h1. Third Title
        {loremipsum:10}
        
        Second Page
        [First|First Page#first]
        [Second|First Page#second]
        [Third|First Page#third]
        

        Once the two pages are created, go to the second page and click any of the links. The anchor should work, by right.

        If the problem persists, kindly raise a support ticket at https://support.atlassian.com, so that your issue can be further investigated. Also provide the following:

        1. A copy of your Confluence log file located at <confluence-home>/logs/atlassian-confluence.log
        2. The system information page. You can obtain the page by accessing the http://<path-to-confluence>/500page.jsp
        3. Screenshots that illustrates the problem.

        Cheers
        JSashi

  14. Jul 17, 2009

    Anonymous says:

    Does anyone know if there is an anchor-include macro? I would like to be able to...

    Does anyone know if there is an anchor-include macro? I would like to be able to include sections from one document in another document. I have looked at using the excerpt and excerpt-include macros for this, but it appears that you can only use the excerpt macro once per document. I want the ability to include the section of text and not just a link to the section. Any ideas?

    1. Aug 19, 2009

      Sashidaran Jayaraman [Atlassian] says:

      Hi, As far as I know, this is not currently possible. However, I have found a s...

      Hi,

      As far as I know, this is not currently possible. However, I have found a similar feature request. Please add yourself as a watcher, vote for this feature and add your own comments to this feature request. For further details on how we include new features and improvements, you might want to read this page

      Cheers
      JSashi

  15. Aug 24, 2009

    Anonymous says:

    Does anchor work fine when used in tempates? I have tested this in a page and th...

    Does anchor work fine when used in tempates? I have tested this in a page and that worked fine but when I try to include the same code in the template (global template), it is highlighted in red
    appendix ?

    [#appendix]
    
    # h2. {anchor:Appendix}Appendix
    

    Am I doing something wrong?

    1. Aug 25, 2009

      Zed Yap [Atlassian] says:

      Hi, Does anchor work fine when used in tempates? I have tested this in a page a...

      Hi,

      Does anchor work fine when used in tempates? I have tested this in a page and that worked fine but when I try to include the same code in the template (global template), it is highlighted in red
      appendix ?

      I found this bug report, which might be related to this issue:

      Please add your comments to the discussion, vote on it and add yourself as a watcher for future updates. Also, please bear in mind the following document on how we schedule features for inclusion in our products: How we approach fixing bugs.

      Hope that helps.
      Best rgds
      Zed

  16. Oct 08

    Anonymous says:

    The directions provided are not very clear to me. I am not understanding how to ...

    The directions provided are not very clear to me. I am not understanding how to link the content with the word. I have input the code North America, with North America being the word I want to link. Now where do I put the next code and what exactly should I put?

    1. Oct 19

      Zed Yap [Atlassian] says:

      Hi, The directions provided are not very clear to me. I am not understanding h...

      Hi,

      The directions provided are not very clear to me. I am not understanding how to link the content with the word. I have input the code North America, with North America being the word I want to link. Now where do I put the next code and what exactly should I put?

      Basically you can put the {anchor:<name>} anywhere. I have created an example below, hopefully, this will give you more understanding on the link and anchor.

      1. Create a new page lets call it testpage
      2. Now insert the following code:
        [#top]
        h1. line break 1
        h1. line break 2
        h1. line break 3
        h1. {anchor:top}The anchor is here!!!
        h1. line break 4
        h1. line break 5
        h1. line break 6
        h1. line break 7
        h1. line break 8
        h1. line break 9
        h1. line break 10
        h1. line break 11
        h1. line break 12
        h1. line break 13
        h1. line break 14
        h1. line break 15
        

      As you click on the top link, you will be directed to the anchor.

      Hope that helps.
      Best rgds,
      Zed

  17. Feb 10

    Subhash Mathur says:

    It appears that one can create anchors in RTE using the macro-browser, but there...

    It appears that one can create anchors in RTE using the macro-browser, but there does not appear to be a way to create links to these anchors in RTE.

    It would be nice to provide the option in insert-link pop-up.

    1. Feb 25

      Jack Low [Atlassian] says:

      Hi Subhash, The way we create links to anchor is same as how we create a normal ...

      Hi Subhash,
      The way we create links to anchor is same as how we create a normal link. When creating a link in rich text editor, we can provide something like:

      #bottom
      

      to link to the anchor, eg:

      Link: #bottom
      Alias: This link links to anchor link at bottom
      Tooltip: anchor link to bottom

      It will create a link that link to bottom(anchor).

      I hope it helps. Please feel free to ask again if you need further assistant.

      Thanks & regards,
      Jack

  18. Mar 11

    Emily Johnson says:

    I have a glossary in one space that I have "included" in another space. The anch...

    I have a glossary in one space that I have "included" in another space. The anchors that work in the original space do not work in the secondary space. Does anyone else see this? Any solutions?

    Thanks,

    Emily

    1. Mar 11

      Emily Johnson says:

      Apologies, it's not the anchors, it's a table of contents that isnt translating....

      Apologies, it's not the anchors, it's a table of contents that isnt translating.

Add Comment