linking Anchors on wiki pages do no redirect to the location
Asked by Zatmar Mujahid:

Hi,

I am trying to link an anchor on one page to the other page, but in the same space. However the link to the anchor only directs to the page rather than the exact anchor location. I am using the given format that is, pagename#anchorname

Is there any other way to link the page to exact location on another page? Or how does the anchor works because it is not working for me.


Answers:
author: Fabienne Gerhard
body: Hi [@Zatmar Mujahid](/t5/user/viewprofilepage/user-id/4071899)

try this

1. move the Anchor out of the Expand macro (experienced trouble on this ones)
2. Create link Patrol Reports#PSR -\> Be aware of spaces as well

Does this work?

Another option could also be: Create the link Patrol Reports#Profile Status Report as the Expand macro works as an heading (check on settings here)

If non of this is working we will find another solution.


author: Zatmar Mujahid
body: [@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720) I added an anchor under one expand on a page:  
![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/160308i7C740782D6947FB2/image-size/large?v=v2&px=999 "image.png")

Which I am trying to access on another page, by linking like this as shown below, also tried without the expand name, just used the page name and anchor name, but nothing works for me.  
![image_2021-09-15_125308.png](https://community.atlassian.com/t5/image/serverpage/image-id/160309iE221C35A0A360D58/image-size/large?v=v2&px=999 "image_2021-09-15_125308.png")


author: Fabienne Gerhard
body: Hi [@Zatmar Mujahid](/t5/user/viewprofilepage/user-id/4071899)

linking to an expand macro can be tricky - did you set an Heading or an Anchor? I created several FAQs pages using the expand macro there too and it worked fine.

Maybe you can share one or two screenshots to specify the problem what exactly is happening. Be aware that the heading/anchor has to be written exactly the same the way in link. For example:

This is my awesome heading -\> Pagename#This is my awesome heading


author: Zatmar Mujahid
body: Thank you for the help, I am trying to link to the expand on another page, but in the same space. Tried using the page name#anchor name also the page name#expand name#anchor name, but still not working.


author: Fabienne Gerhard
body: Hi [@Zatmar Mujahid](/t5/user/viewprofilepage/user-id/4071899)

how exactly did you set the anchor? Did you use the anchor macro or did you try to link on a headline (which is another way to link on a direct position on a page).

For anchors it is important to follow the instructions as mentioned [here under Step2](https://confluence.atlassian.com/doc/anchors-139442.html)

|   **Anchor location**   |    **Link syntax for anchor**    |                     **Examples**                     |
|-------------------------|----------------------------------|------------------------------------------------------|
| Same page               | #anchor name                     | #bottom #important information                       |
| Page in same space      | page name#anchor name            | My page#bottom My page#important information         |
| Page in different space | `spacekey:page name#anchor name` | DOC:My page#bottom DOC:My page#important information |

When linking on a headline there are some tricks but try this:

|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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`. For a heading on another page in this space: `Page Name#MyHeading`. For a heading on another page in another space: `spacekey:Page Name#MyHeading`. Be aware that these links will break if you edit the heading text. Consider using the [Table of Contents](https://confluence.atlassian.com/doc/table-of-contents-macro-182682099.html) macro or an [Anchor](https://confluence.atlassian.com/doc/anchors-139442.html) instead. |