A few questions about linking to headings
Asked by Eileen Palsson:

From what I gather, in order to link to headings I have to create an anchor for each heading that I want to link to. Is this correct?

If I change the wording of the heading, do I have to go back and edit the link text of all links to that heading?

I export my content to PDF. Can I insert some type of field that will result in a *page number* (that is, the page where a specific heading is located) in the PDF output?

Thanks in advance!


Answers:
author: Fabienne Gerhard
body: Hi [@Eileen Palsson](/t5/user/viewprofilepage/user-id/2605569)

you don't have to create an anchor for a heading - you can link directly to the heading like linking to an anchor.  
`spacekey:Page Name#MyHeading`

But as you mentioned - those links will break when you change the heading. So using anchors may be a better idea. Those don't break when you change your heading because they have a fixed name.

Not sure about your last question. Do you want to show where the link is going to? Because links will work in the pdf after export.

Hope this may help you!

comments: author: Eileen Palsson
body: Thank you, [@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720). I guess I'm going to be using anchors, since I don't want to have to commit myself to the wordings of headings for the rest of the life cycle of the documentation. :-/

But in case I do want to link directly to a heading: You used MyHeading as an example. What if the heading contains spaces? Do I need quotation marks or dashes or something?

About the last question: In the PDF I want it to say, *See "My Heading" on page 47.*Do you know offhand if that will work?

Thanks again!


author: Fabienne Gerhard
body: I would also prefer Anchors! Spaces in Headlines (and Anchors) are no problem. Works perfect in Page Names too.

Page name#The perfect Heading

Do you want to use links that work in the exported pdf (Link on a pdf page to another pdf page)? Not sure if this is going to work - links will be exported to the pdf and are still available BUT out-of-the-box they just link to your Confluence page - which I think is cool so that there are always the latest informations there. I'm pretty sure that you can also create links that just work in your pdf, but I didn't do that yet - sorry.


author: Eileen Palsson
body: Thanks again.

The reference within the PDF need to be clickable references to other pages within the same PDF. We intend to use this for end-user documentation, and our end users to not have access to our Confluence.


author: Zart Colwing
body: > Spaces in Headlines (and Anchors) are no problem. Works perfect in Page Names too.

But don't dare you put an accentuated (????????) character in the page name or the heading. In this case there is no way to make the link to work.

That is SO COOL(!) when writing pages in French !!!


author: Fabienne Gerhard
body: [@Zart Colwing](/t5/user/viewprofilepage/user-id/1010650) - that's interesting. Did you give it a try? I made a page called C?x?? and a headline C'est ?coute -\> worked perfect with

C?x??#C'est ?coute

when you make a link using Link -\> Advance and create the link manually. Even when you change the page name the link still works (and is changed).


author: Zart Colwing
body: I gave it so many tryes, I can garanty you it doesn't work with confluence 6.12.4

It is so difficult to craft a link to a heading! The link dialog is not helping at all. Why isn't there a selector in the link dialog that let you choose the heading once you found the intended page. Instead of that you have to go to the Advanced page where not even the link to the found page is retained - I hate it! And when you messup the link your only solution is to delete the link and start all over again - you can not modify the link.

It's not the only thing that doesn't work related to bad or accentuated characters:

Images whose name contains accentuated characters or even a space will not be displayed (type SHIFT+F5 to refresh your browser cache).

Attempt to save a Draw.io with a space in the name will fail with a puzling message.

Confluence 6.12.4 have so many problems with handling objets name and link name, this is irritating.

P.S. did you know that confluence 6.12.4 refuse to display an image named admin.png ?


author: Fabienne Gerhard
body: Hmm - alright I can understand your frustration - definitly. Seems like there are several problems with apps and and systems ?

What can be a solution for the links is using the anchor macro.

Do you think that it's a problem according only to confluence 6.12.4 because I made the links with 6.5.4....

I found a nice fancy app that may also help you. It's called [Handy Macros](https://marketplace.atlassian.com/apps/1214971/handy-macros-for-confluence?hosting=server&tab=overview) from Stiltsoft. It gives you several solutions and one them is called [Handy Heading](https://docs.stiltsoft.com/display/public/HMFC/How+to+use+Handy+Heading) ? have a look on the linked [documentation](https://docs.stiltsoft.com/display/public/HMFC/Handy+Macros+for+Confluence+Home?utm_source=marketplace). I find it very useful and the pricing is ok.


Tags: heading

link

pdf