Inserting a link to an anchor on another page creates a "create page" link instead
Asked by Graham Hannington:

I have a Confluence (Server, 6.7.0) page with the title "5 Information security policies". (Yes, with a "hardcoded" heading number... possibly too much information: this heading is a "control" from ISO/IEC 27001:2013 Annex A.)

The page contains the heading "5.1.2 Review of the policies for information security". (If Confluence supported search'n'replace across pages out of the box, I would consider chunking the page so that this "5.1.2" heading was its own page, and the problem I'm having would evaporate. But that's another discussion.)

I've inserted an Anchor macro, with the anchor name "5.1.2", at the start of that "5.1.2 ..." heading.

Here's what I did to create a link to that anchor (that heading) from another page in the same space:

1. Edit the page (where I want to insert the link).
2. Select the text that I want as the link text.
3. Click **Insert link**.
4. Click **Advanced**.
5. Begin typing the page name in the **Link** box. An "autocomplete" entry appears under the **Link** box with the page name and anchor I want, "5 Information security policies#5.1.2".
6. Click that autocomplete entry. This fills in the **Link** box.
7. Click **Insert**. The link text appears highlighted, but with a different appearance from page links: the link is underlined, even when I'm not hovering over it.
8. Save the page.

When I view the saved page and inspect the resulting link, here's the URL (I've replaced some strings with "..."):

```
http:// ... /pages/createpage.action?spaceKey= ... &title=5+Information+security+policies&linkCreation=true&fromPageId=...
```

Clicking the link creates a new page, which is not what I want.

How do I create a link to the anchor? What am I doing wrong?

Is there is an issue with the periods in the anchor?


Answers:
author: Tim Baker
body: The full answer is in the [anchor documentation](https://confluence.atlassian.com/conf612/anchors-958777373.html). There are different syntaxes according to whether the anchor is on the same page, same space or different space.


author: Fabienne Gerhard
body: Good to hear, - no worries that's what the community is all about :) helping and sharing experiences we made.

As you can imagine from what I've written - I've made similar experiences like you when setting anchors ;)


author: Graham Hannington
body: Thanks for the suggestions.

I'm embarrassed to admit that it was user error: my problem.

Yes, I selected "5 Information security policies#5.1.2" from the autocomplete entry that my browser (Chrome) displayed under the **Link** input text box, but *a page with that title no longer existed* . I'd forgotten that I'd appended a string in parentheses to the end of that page title: so the actual current page title was "5 Information security policies (...)#5.1.2" (I've used "..." instead of the actual string, which I don't want to show here).

I can't blame Confluence for that autocomplete entry; that's browser behavior, not Confluence.

You were right:
> maybe '5 Information security policies' is a page that doesn't exist

Thanks again!

Apologies to all for my misleading "report".

P.S. I was initially nervous when the working URL showed the page title in the hash:

```
http:// ... /pages/viewpage.action?pageId=50332014#id-5Informationsecuritypolicies(...)-5.1.2
```

but I needn't have worried. When I edited the destination page, and changed its title, and then refreshed the page containing the link (in another browser tab), Confluence had updated the hash to reflect the edited page title. Phew.


author: Fabienne Gerhard
body: What just came to my mind right after my reply - is the page you create the link in the same space? Maybe you have to put the spacekey also in

**XXX:5 Information security policies#5.1.2** (spacekey:page name#anchor name)


author: Fabienne Gerhard
body: Hi [@Graham Hannington](/t5/user/viewprofilepage/user-id/544968)

did you try to remove the anchor and link directly to the heading?

I'm not sure what you mean by autocomplete - but when you open

**Insert link -\> Advanced**

you should just fill in

**5 Information security policies#5.1.2** (page name#anchor name)

in the ++first++ box.

++Second++ box would be link text you marked!

**Awesome security information** (Text shown on site)

I made the experience when a page doesn't exist or the user doesn't have access rights the createpage action is made instead of viewpage -\> a hint for that would be the underline and changed color for that. (and maybe '5 Information security policies' is a page that doesn't exist?)

I would first try to set a link directly to the page -\> in Edit mode press \[ than start typing *5 Inform... -\>*if it doesn't autofill, page name is not correct.

Try to add the link like written on top.


Tags: anchor

confluence-server

server