Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How best to link to headings

Robert Mark Bram April 1, 2012

In Confluence 4, I can type [ and it lets me search for pages in my Confluence to link to, which is great. But how then do I link to headings on that page? So far, the only way I have found is to manually copy the entire URL and link to that. I was hoping the fancy search function could root out headings within a page too.

6 answers

12 votes
HuseinA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2012

This can be done by going through the 'Advanced' tab in the 'Insert Link' dialog as described in this page:

http://confluence.atlassian.com/display/DOC/Linking+to+Pages#LinkingtoPages-LinkingtoanAnchororHeading

cirosantilli June 13, 2018

Confluence, please allow every heading to have its own anchor as part of the heading feature itself. Like Asciidoc. Adding anchors manually is annoying.

Like # people like this
Michael Coburn September 20, 2018

If you include a TOC always on your pages, then you can get a free anchor to the headings (right click elements in TOC on a rendered page)

Like # people like this
m_parker2 October 19, 2018

Thank you Michael! This simplifies things for me.

Like Martin Gregory likes this
serhiyk November 23, 2018

here now links to headers work out of the box

Mathias Groppler July 1, 2019

The approach with the TOC doesn't work when the heading is changed. The link copied from the TOC is not updated. I would prefer that you could search for #My heading and the link would be updated when the heading changes similar to page links

Like # people like this
pavelpigalov December 26, 2020

The desired approach with "Page#Heading" still doesn't work for me in 2020 which is very annoying.

For some reason when I copy this from TOC, it creates "red link" instead of expected documented behavior.

Had to use Anchor Macro to make it work, finally :(

5 votes
Tobias Anstett _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2018

Hi,

Best practice to use the anchor macro. This creates an anchor inside the page, which can be hyperlinked as documented at https://confluence.atlassian.com/conf68/anchors-947170225.html

I referred to this as best practise as you will have to specify a key for your anchor which will not break if you adopt the heading in the future - links will still work.

Best, Tobias

0 votes
skube January 24, 2020

Just throwing out another potential solution to this annoying problem.

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

0 votes
Deleted user April 26, 2019

Screen Shot 2019-04-26 at 2.23.57 PM.png

0 votes
Dan Mergens June 1, 2016

My version of Confluence (3.4.7) does not include an 'Advanced' tab in the 'Insert Link' dialog.

I can insert the link to a heading using the heading name in the 'Web Link' -> 'URL' field.

Alain Moran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2017

Each heading item has an id attribute that you can append to the url of the page to link directly to a heading.

However you don't need to use the page url, you can do it with the page name and wiki-markup, eg:

[My Page Name#MyHeadingId]

https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html#ConfluenceWikiMarkup-Links

Like # people like this
George Mogilevsky January 17, 2019

i have a table with multiple rows. some of these rows are set with h4 tag. When the heading tags inside the table have inline comments, they don't have the id attribute or the heading id. Is it possible to link directly to these headings?

Tobias Anstett _K15t_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 17, 2019

Hi @George Mogilevsky,

please refer to my answer above. Using the anchor macro solves all issues :)

Best, Tobias

George Mogilevsky January 18, 2019

Hi Tobias,

Thanks for that. It is indeed a workaround! I read it before posting. It requires me editing pages. Not ideal in my situation though. I'd prefer if the inline comment wrapped the heading, not substituted it. As it breaks existing links and doesn't allow linking into headings.

 

Best,

G

Carla Woodgate December 3, 2019

Hello Tobias

Since there is no Anchor macro in the cloud version of Confluence, this is not a viable response for those of us using the cloud version. 

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events