how to SIMPLY create a link to anchor to my confluence site from external site
Asked by Richee Pitchee:

hi, I have read all the posts how to create links to anchor (<https://confluence.atlassian.com/doc/links-776656293.html>) I have learned, what is the syntax, from that page. OK. But I am looking for a simple way to grab the link to my page that is in this syntax.

That is to say, I do not want to manually write the link according to this guide: <http://myconfluence.com/display/spacekey/Page+name#pagename-anchorname>

I am looking for a place, that I can copy the link, that includes spacekey, pagename... to my site. then I will only add the cross and anchor name and I can copy the link to my external site and it will work.

my problem is, that manually puzzling this link together takes a lot of time and several tries: i have to find the space key, that I have to play with two versions of the pagename and only then I can add the anchor name.

The ideal way would be that the Anchor macro could contain the link in the UI that I could only copy to my clipboard.

linking to an anchor is very complicated for me

thanks for hints, maybe I am missing something obvious


Answers:
author: Zak Laughton
body: Hi Richee,

The easiest way to get the link for an anchor on a page is to create Confluence link to the anchor, then copy the link URL.

Here are the steps I'd take on a page that has an anchor titled "myanchor":

1. Click **Edit.**
2. Type \[#myanchor\]  
   *The open bracket should start the link creation, and the close bracket will create the link.*
3. Save the page.
4. On the newly created link, right-click \> **Copy link URL**

Now you can paste the correctly formatted URL wherever you'd like, without manually trying to create the URL.

I hope this helps!  
-Zak

comments: author: Richee Pitchee
body: Thank you Zak, this works perfect.

Why this trick is not available on the standard help page? It is not possible to construct the link manually for pages with complex names. what a shame

<https://confluence.atlassian.com/confcloud/insert-links-and-anchors-724764900.html>


author: Bill OLeary
body: This sounds easy enough, but

here is a link I got from copying an anchor

<https://cadenhance.atlassian.net/wiki/spaces/PD/pages/596574211/Part+Addition+Guide>

so the page name is "Part Addition Guide"

But where does the 596574211 come from?

When might that number change?

Will it change if I make a change to the page?

Will it change if I delete the page and add the same named page back?

In other words, if I hardcode this link into a help link one of my tools, how will I know when I need to update that link?


author: Richee Pitchee
body: hi, now we have a Copy link next to each header in confluence pages.

Look like this:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/37095i620C3A98C9DDCCF6/image-size/large?v=v2&px=999 "image.png")


author: Bill OLeary
body: Thanks, but that doesn't answer my question completely

<https://cadenhance.atlassian.net/wiki/spaces/PD/pages/596574211/Part+Addition+Guide>

I was able to get the link, I want to know where the number 596574211 came from

in that link, and when it might change.

I provide a tool to my customers and am trying to add buttons to take them to appropriate documentation for certain features... If I edit the page and the link changes, then my approach is doomed to failure :)


author: Bill OLeary
body: and I don't see that copy link...

I am using confluence cloud, would that change anything?


author: Richee Pitchee
body: Hi. Sorry, I found that Copy link tool is a part of macro set installed to our confluence. it is this: <https://docs.stiltsoft.com/display/public/HMFC/How+to+use+Handy+Heading>

The number in your link example is the ID of the confluence page. It never changes, whatever is the name of the page. This is my experience. On the other hand, when you set the page to edit mode, there is a number higher by one. check it. but published page number never changes, I believe.

However, if you refer the a header on the page (using anchor or whatever), you cannot change the name of the header, obviously. it has no ID.


author: Bill OLeary
body: Richee,

Thanks for the detailed answer!  
Unfortunately the Handy Macros are not compatible with Confluence Cloud!

The only "external" links I can seem to find always have the Page ID in them and I have not been able to figure out how to get a link to just a header, or even to an explicit anchor I added on a page.


author: Richee Pitchee
body: In past I found this:

The easiest way to get the link for an anchor on a page is to create Confluence link to the anchor, then copy the link URL.

Here are the steps I'd take on a page that has an anchor titled "myanchor":

1. Click **Edit.**
2. create anchor with name "myanchor"
3. Type \[#myanchor\]
4. *The open bracket should start the link creation, and the close bracket will create the link.*
5. Save the page.
6. On the newly created link, right-click \> **Copy link URL**

Now you can paste the correctly formatted URL wherever you'd like, without manually trying to create the URL.


author: Bill OLeary
body: Thats essentially what I've done...

One nice thing to do is to add a TOC on your page and then the Header links will be available to copy from there

I wish the Handy tools were available for confluence cloud!


author: Marcel Kleinl?tke
body: Is there a way to link to favourite spaces without using the macro


author: Daniela Branco-Bartlett
body: Here is a good utube for how to anchor a text within the same page: <https://www.youtube.com/watch?v=REk_5DOhYqI>

To link any confluence document, simply add the name of the document, highlight it and click command+k or control +K to enter the link and save it.


author: skube
body: Just throwing out another potential solution to this annoying problem.

<https://github.com/grantwinney/generate-links-for-headers>


Tags: confluence-server

server