Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Proper syntax for anchor links in imported Word docs

Deleted user March 13, 2019

Hey folks, I have been fussing with this for a couple of days now and nothing seems to work. I know this has come up before, but I don't yet have a solution. 

I have a Word doc (software manual of 250+ pages) that I imported to our Confluence Server (v6.14.1) Confluence imported each chapter of the doc into a separate page (as requested).

As others report, links to individual chapters/pages and to anchors within each page behave as they should. 

There are a ton of cross-references between chapters/pages, so I've made anchors for each cross-reference. I'll note that Confluence created numerous anchors for each heading -- mostly referencing the Table of Contents (example: _Toc384453954), but also what seems to be a cross-reference (_Ref78100551). These examples are next to the heading "Working with Self-Extracting (PKSFX) Archives" in a page/chapter called "3 _Adding Files to an Archive."

 If I create a link on another page to the Self-Extracting Archive anchor with this wording on the Advanced field and save, Confluence creates a new page when you click the link: 

3 _Adding Files to an Archive#SFX (the anchor I created; and yes, it's all caps in the anchor)

Same thing happens if I use _Ref78100551 as an anchor.

If I use the full URL with #SFX in the Advanced field, Confluence points to the top of the page, but doesn't look for the Anchor.

https://confluence.pkware.com/display/SPE/3++_Adding+Files+to+an+Archive#SFX

Not to get ahead of myself, but once all this gets sorted out, the whole mess will be published on a separate (public) Confluence instance. I fervently hope I won't have to redo all the anchor links before publishing over there! 

Thanks for reading through all this detail. I hope there's enough here to find an answer.

 

1 answer

0 votes
Bill Bailey
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.
March 14, 2019

Well anchors/links within a page have a different format than they do page to page. So for example, the storage format for a link to an anchor on the same page takes the form of

<ac:link ac:anchor="Figure2">
<ac:plain-text-link-body><![CDATA[figure]]></ac:plain-text-link-body>
</ac:link>

But a link to the same anchor from another page will appear in the form of

 <ac:link>
<ri:page ri:content-title="Table and Figure Macros"/>
<ac:plain-text-link-body><![CDATA[figure]]></ac:plain-text-link-body>
</ac:link>

So for cross-page links, you need the page reference. I suspect that all your links appear like the same page links.

Take a look at the storage view to see how you links appear, let me know, and I should be able to propose a course of action.

Deleted user March 14, 2019

Here's the (broken) link to an anchor on another page: 

<ac:link><ri:page ri:content-title="6 _Working with Digital Signatures and OpenPGP Keys" /><ac:plain-text-link-body><![CDATA["Checking for Revoked Certificates" in Chapter 6]]></ac:plain-text-link-body></ac:link>.)

 Here's a (working) link to an anchor on current page:

<ac:link ac:anchor="ExtractSTDIN"><ac:plain-text-link-body><![CDATA["Extracting an Archive on STDIN or a Special File"]]></ac:plain-text-link-body></ac:link>)

Hmm...What's that exclamation point (my highlighting) doing there before the [CDATA reference? How did it get there?  

Bill Bailey
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.
March 14, 2019

OK, sorry, I see that my cross page example was not complete. It should be of the form

<ac:link ac:anchor="Figure2">
<ri:page ri:content-title="Table and Figure Macros"/>
<ac:plain-text-link-body><![CDATA[figure]]></ac:plain-text-link-body>
</ac:link>

So in your code, you are missing the ac:anchor attribute.

The ! does belong there. It is part of the CDATA XML syntax.

 

So how to fix, if you can edit the link then you need to enter the the page and anchor under the Link field on the Advance tab, it is of the form of page name (with spaces)#anchor_name(no spaces). See links.

Otherwise, you need to install the Source Editor and get your hands dirty in the storage code of the page.

Deleted user March 15, 2019

Thanks, Bill. It looks like I'll have to get the Source Editor.

Unless the page name is something different than the title. When using the Advanced tab for the link, my form is: 

3 _Adding Files to an Archive#SFX
Bill Bailey
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.
March 15, 2019

Does the page title really have that leading underscore? That it is really "3 _Adding Files to an Archive"

If the URL here is accurate:

https://confluence.pkware.com/display/SPE/3++_Adding+Files+to+an+Archive#SFX

Then there are two spaces between 3 and the _. So if the link is somehow swallowing one of those spaces, it will break. Anyway, one you take a look at the storage view, you will know more.

Deleted user March 18, 2019

I think I've resolved the situation (at least it works for me): Removing the chapter numbers. I first tried adding a space to the chapter reference as you suggested, but that didn't work to activate the anchor link.

Since we had been considering dumping the chapter numbers anyway, to permit extra flexibility in putting the pages in order, I tried that, and all links are working. 

Thanks for your help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events