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. There are two steps to using an anchor:
|
Creating an Anchor
You use the Anchor macro to create an anchor for content that you want to be able to link to.
To add the Anchor macro to a page:
- In the Confluence editor, choose Insert > Other Macros.
- Find and select the required macro.
Parameters
When editing, you can click on the macro placeholder and choose Edit to display the parameters for this macro in the Macro Browser.
Parameters are options that you can set for Confluence macros to control the content or format of the macro output. The table below lists parameters for this macro that can be set in the Macro Browser.
Parameter | Default | Description |
|---|---|---|
Anchor Name | None; name must be supplied | This is the value for |
Linking to an Anchor or Heading
You can link to an anchor or heading that is on the same page, on another page in the same space, or on a page in another space of the same Confluence site.
To link to an anchor or heading:
- Click Link in the toolbar, or press Ctrl+K, while editing the page.
Click Advanced and enter the anchor name (or heading) into the Link box, using the following syntax:
Anchor or heading location
Link syntax for anchor
Link syntax for heading
Same page
#anchorname#headingnameDifferent page
pagename#anchornamepagename#headingnamePage in another space
spacekey:pagename#anchornamespacekey:pagename#headingname
For more information about link syntax, see Confluence Wiki Markup.- Enter link text that will be displayed on the page, if required. If you leave the Link Text box empty, the link will display the destination page name or URL.
- Click Insert.
- Note that when linking to a heading,
headingnameis case-sensitive and must be entered without spaces - Note that when linking to an anchor,
anchornameis case-sensitive, andpagenamemust be entered with spaces as in the title.
Notes
- If you are adding an anchor to the site welcome message, it can only be linked to from another page. Internal-only links will not render.
- 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.
Related Topics
Take me back to the Confluence User's Guide.







33 Comments
Hide/Show CommentsDec 04, 2007
Anonymous
I need to link to an anchor from outside Confluence. What's the URL for that? I've tried page#anchorname without success.
Dec 04, 2007
Choy Li Tham
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:
Regards,
Choy Li
Dec 06, 2007
Anonymous
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:
Feb 13, 2008
Anonymous
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.
Feb 14, 2008
Ming Giet Chong
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
Feb 28, 2008
Anonymous
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
May 28, 2008
Anonymous
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
Jun 02, 2008
Ming Giet Chong
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
Jul 08, 2008
Anonymous
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?
Jul 09, 2008
Azwandi Mohd Aris [Atlassian]
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:
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
Jul 22, 2008
Anonymous
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.
Jul 23, 2008
Azwandi Mohd Aris [Atlassian]
Hi there,
You might want to try the following to set an anchor to headers:
Hope this helps.
Cheers,
Azwandi
Feb 04, 2009
Brian Carr
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 DIt 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!
Feb 05, 2009
Komathi Krishnan [Atlassian]
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
Feb 26, 2011
Klaus Feldmann
Toc macro does list headings and question is about listing anchors – I checked this out today because I was looking for same solution:
How to list anchors of a page?
Jul 15, 2009
Karal Gregory
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!
Jul 17, 2009
Paul Schacht
I'm having the same problem. Firefox 3.5.
Aug 19, 2009
Sashidaran Jayaraman [Atlassian]
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
Second Page
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:
Cheers
JSashi
Jul 17, 2009
Anonymous
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?
Aug 19, 2009
Sashidaran Jayaraman [Atlassian]
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
Aug 24, 2009
Anonymous
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 ?
Am I doing something wrong?
Aug 25, 2009
Zed Yap [Atlassian]
Hi,
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
Mar 23, 2010
Anonymous
I would like to create an anchor in a Confluence page and then reference it in a URL that I am sending to a colleague. I can create the anchor just fine, and I have tested it by using an internal link from another wiki page to that page and it works fine. But, if I append the #nameofanchor to the tinylink URL:
*http://wiki.xxx.local/x/nYBJ#nameofanchor*
or to the other type of URL:
*http://wiki.xxx.local/pages/viewpage.action?pageId=4817053#nameofanchor*
nothing happens (it goes to the page, but not down to the anchor).
What is the syntax for a URL from someplace outside the wiki, to a page inside the wiki, including the anchor?
And (hoping that that uses the TinyURL from the Info page so that it is stable), a step by step guide to constructing that case in the above discussion would be really helpful.
Thanks!
Mar 24, 2010
Husein Alatas
Hi,
You need to append the Page Title before the name of the anchor.
For example, let's say the page title of "http://wiki.xxx.local/x/nYBJ" is Test Page - Anchor, then the URL including the anchor (Page Title + anchor name) should look like this:
Note: You need to remove all spaces in the Page Title before appending it to your anchor name. And also anchor must be case-sensitive.
I am afraid the TinyURL will not be stable anymore if there is any changes in the page title in the future knowing that page title should be appended along with the anchor name.
Hope that helps
.
Regards,
Husein Alatas
Dec 01, 2010
J.B. Nicholson-Owens
I am editing Confluence wiki pages which are very long. These pages have headers that would make a good menu at the top of the page to allow readers to jump to that particular section (very much like Wikipedia entries have). I'd like to put something near the top of such long wiki pages that easily let the reader jump to a particular section, but I want this internal list of links to be automatically built and maintained by the wiki --- every time someone adds a new h1. this menu grows and the list of links are sorted according to how the h1's appear in that page.
I thought of using the children macro but that only targets child pages. I need something that will build and maintain links to elements on the same page.
I can give IDs to the headers if that would help, but it would be great if this function assigned such IDs itself where IDs were not already present.
How should I make such a self-maintaining list of links?
Apr 05, 2011
Anonymous
Does the TOC plugin do the trick for you?
Matthew (also @illinois :)
Jun 10, 2011
Anonymous
If you give a heading a color, then you cannot use the heading name as an achor link. This is a bug.
Sep 30, 2011
Anonymous
In my version of Confluence there is no Advanced setting after clicking the Insert Link button. So, instead, I entered the anchor name in the Url field of the Link tab and it worked.
Additionally, after saving, I highlighted the linked word and clicked Insert Link again. I noticed it removed the anchor name from the Url field and automatically appended it to the end of the Link Text like so - [Series|#series-anchor].
Oct 12, 2011
Anonymous
Can anyone please explain to me how to link to a heading on the same page. For example, I have Heading 4 with the name Power source. I want to link to this heading from another place on the same page. What should I type on the Advanced tab of the Insert Link window?
Oct 14, 2011
Edwin Dawson [Atlassian Technical Writer]
Hi there,
For situations like this where the heading has spaces in it, simply remove the spaces.
So for your example, you would type #Powersource into the Advanced tab of the Insert Link window.
Oct 19, 2011
Nicole Perrault
I do not have the Advanced setting on the Insert Link dialog. I tried entering the heading name in the URL field, but that does not work. I tried entering it with and without spaces. I also tried creating an anchor and linking to that within the same page, but that doesn't seem to work either. Any ideas? Is it possible that my version of Confluence doesn't support this?
---
I looked back at Sashidaran's post and as able to get things working. Thank you!
Nov 17, 2011
Vladimir Alexiev
Please amend the documentation to say that every heading is automatically an anchor
Nov 29, 2011
Anonymous
Hi. We're using 3.5.x, but I'm unable to comment to the corresponding topic in that version's space.
I have noticed that when you change a page or heading, links to that heading/anchor are not updated dynamically.
In fact, when I changed the name of a page used in a link that included an anchor (#), the link broke completely.
If you change just the heading, the link still works, but it goes to the top of the page instead of to the heading/anchor.
Please advise.
Thank you.
Jay L. Abramoff, Information Developer, BMC Software
Add Comment