Anchor changes after updating page
Asked by Nina Kasap:

I use anchors to link to the text on the same page, in the same tab. But, whenever I update the page, the anchor changes, and leads to the old version of the page.

**Example:**

I have a page called *Confluence Page.* In one of the tabs, I write the example text below and anchor the underlined word. After the anchor is initially set up, if the anchored word is clicked, the user will be redirected to the anchor. The anchor will be named only #anchor. So initially, it works as intended

*text text ++anchored word++ text*

However, once I update the page, the anchor name changes to *Page Name#anchor* (in this example would be *Confluence page#anchor*). And once the anchored text is clicked on, it leads to the old version of the page.

Can you please help me figure this out? As it works now, I have to update anchors each time I change something on the page, which renders them useless.


Answers:
author: Fabienne Gerhard
body: Hi [@Nina Kasap](/t5/user/viewprofilepage/user-id/4217804)

welcome to this wonderful community

You are using anchors to link to headlines right? Some text that starts at further "away" on the page?

Which version of server are you running? I would like to recreate the problem to find a solution with you.

comments: author: Nina Kasap
body: Hi [@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720) , thank you so much for checking this. In a nutshell, yes. I put an anchor on the title, and it needs to lead to some point down in the text.

The Confluence version is 7.4.0.


author: Fabienne Gerhard
body: Hi [@Nina Kasap](/t5/user/viewprofilepage/user-id/4217804)

hmm - I made a look and found two JIRA Tickets where your problem is mentioned (but version doesn't match) Have a look on [CONFSERVER-51690](https://jira.atlassian.com/browse/CONFSERVER-51690) and attached [CONFSERVER-60444](https://jira.atlassian.com/browse/CONFSERVER-60444)

My idea would be:

1. switch off collaborative editing (if you don't need it and if possible) and give it a try if this still happens
2. If no. 1 doesn't work: create the anchor links with page name#anchor and check out if this works (as mentioned in the first ticket as a possible workaround) o
3. If no. 2 is not working: Insert TOC macro - show all headlines - get the links for anchor after the space /
4. If no.3 is not working: Use the TOC macro - show all headlines - get the links as webadress for the links (not a very comfortable way and quick \& dirty)
5. If nothing works out -\> check out an app I made good experiences with [Handy macros for Confluence](https://marketplace.atlassian.com/apps/1214971/handy-macros-for-confluence?hosting=server&tab=overview). One of the things it can do is getting the links to headlines super fast with one mouse click, but it can do many other things too. Give it a try!

Let me know how it worked out!


author: Nina Kasap
body: Thank you [@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720)[CONFSERVER-51690](https://jira.atlassian.com/browse/CONFSERVER-51690)[@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720)is related to the issue I am facing. I tried your solution, and:

1. Switching off collaborative editing is not possible, so I can't try it out.

2. I tried this, but, to complicate things, this error is not happening every time I update the page. I can update the page 20 times, and the anchor will be working, then come after a while, and it's broken. So I am not even really sure what the trigger is. I will try to replicate the issue again, and I will try out this solution.

3 and 4. If TOC worked as I need it, it would solve all of my problems. So to specify what I need, I am making a list of FAQs in one tab. So at the top of the page, I have a list of questions, and below detailed answers for each. I have an anchor before each answer. So text of question 1 is hyperlinked, and if you click on it, it takes you to the anchor, in from of the answer. The issue with TOC is that it displays only titles, and for the whole article. I need it to display paragraph type text, and from one tab. Here is an example of what I need <https://prnt.sc/wl3vrf>. As far as I know, there is no other macro that can do this.

5. The link you posted does not open, can you please post it again?

I hope this gives you more info on the issue.


author: Fabienne Gerhard
body: Hi [@Nina Kasap](/t5/user/viewprofilepage/user-id/4217804)

oh ok - Let's see if we can find a working solution with TOC ? already got an idea (hope this may fit for you) Worked on several FAQ sites

From your screenshot I see what you want (hopefully) - my solution would be:

* Post the question as headline (maybe only heading 3 or 4) before the answers and use them as anchors (you can link to them via #headlinename in advanced but we won't need it)
* Insert Toc at the beginning of page and set min/max level to the heading of the questions you used
* Write your answers in the UI boxes (it's refined isn't it)

Now you should have a list with all questions at the beginning of the pages where you can click on and jump perfectly to the answer on page

to make it even more shiny

* you can put the answers in expand macro
* "hide" the questions by making them white - they disappear on the page but are still there

Do you think this could be a solution?

The addon/app is Handy macros for confluence from Stiltsoft -\> have a look on [marketplace](https://marketplace.atlassian.com/apps/1214971/handy-macros-for-confluence?hosting=server&tab=overview) (that's the link i posted) or directly on the [developer page -\> Handy Heading](https://docs.stiltsoft.com/display/public/HMFC/Handy+Macros+for+Confluence+Home)


author: Nina Kasap
body: [@Fabienne Gerhard](/t5/user/viewprofilepage/user-id/971720) thank you for the suggestion. Seems like I managed to get my result, but not by TOC, but by TOC zone macro. I have a whole article and then 1 tab with FAQs, so TOC won't work.

Thank you for your help :)


author: Fabienne Gerhard
body: Great that it worked - have to check out TOC zone ?


Tags: confluence-server

server