External web page to get link to anchor placed on Confluence user home page

DUDZIAK Krzysztof September 17, 2021

External web page needs to get a link to anchor placed on Confluence user home page.

Which is working format?

 

If following format needs to be used (found on https://confluence.atlassian.com/conf74/anchors-1003128455.html)  how to find spacekey?

http://myconfluence.com/display/spacekey/pagename#pagename-anchorname

1 answer

0 votes
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 17, 2021

Hi @DUDZIAK Krzysztof 

As per the example on the same link DOCS is the space key in below link - http://myconfluence.com/display/DOCS/My+page#Mypage-bottom

DUDZIAK Krzysztof September 20, 2021

Thanks for hint from you which I immediately tried out. Unfortunately it didn't help, anchor link placed to external web document does not open.

During this test I figured also out the Confluence article my anchor is placed to is addressable by URL of following form

 

https://myconfluence.com/spaces/viewspace.action?key=~usernick

However, document opens also by URL this type https://myconfluence.com/pages/viewpage.action?pageId=<string of 9 digits> 

 

Hence it seems to be actually a space.I wonder if this is of any significance for anchor link type to choose.

 

How to understand 'My+page' and 'Mypage-bottom' tokens ? Maybe their values are wrong in my anchor link.

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

I tried to add an external link with an anchor on my confluence page and it is working as expected.

You are right, the link you pasted seems to be a link to space and not a page. The page link should be something like below -

https://MYDOMAIN.atlassian.net/wiki/spaces/MYSPACE/pages/123456/TestPage#anchor 

DUDZIAK Krzysztof September 21, 2021

Thanks for hint.

How to understand the token '123456' , how does it distinct from 'TestPage' token?

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

That number is a content ID created internally by confluence. If you open a page in confluence, simply copy the URL from the browser, it will be the url of your page.

DUDZIAK Krzysztof September 21, 2021

Thanks for information.

Isn't 'TestPage' token in your url pattern the page name (or page title)?

Am I wrong in belief content ID and page name (page title) are unambiguously identifying Confluence document each?  If my understanding is correct I wonder why two unambiguous document identifiers are needed in URL.

I am still on digging as my link in external web document to anchored Confluence is still not working. Currently I use link of following format https://myconfluence.com/wiki/spaces/MYSPACE/pages/123456/TestPage#anchor

whereby

123456 placeholder replaced with content -ID found in document url this format

https://myconfluence.com/pages/viewpage.action?pageId=<string of 9 digits>

and TestPage token replaced by document title normalized (underline chars instead of spaces).

---

I forgot also to mention there are special characters (at least one) in page title my anchor has been placed too - it is this way due to how Confluence is titling user home document. Possibly it is of significance here.

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2021

Correct, "TestPage" is may page's title in confluence. So yes, the content ID and Page title are identifying the confluence page. I can use both to refer an anchor -

https://myconfluence.com/wiki/spaces/MYSPACE/pages/123456/TestPage#anchor

OR

https://myconfluence.com/wiki/spaces/MYSPACE/pages/123456#anchor

From the earlier page, notes about the full URL:

  • The page name is repeated in the URL, after the # sign. The second occurrence of the page name is concatenated into a single word, with all spaces removed.
  • There is a single dash (hyphen) between the concatenated page name and the anchor name.
  • The anchor name in the full URL is concatenated into a single word, with all spaces removed.
  • The anchor name is case sensitive.
  • If the page name contains special characters, where the URL displays a page ID rather than a name, the link to an anchor will look more like this http://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page1!-anchor 
    In this example the page title is Test - Page 1! and the anchor name is anchor.
DUDZIAK Krzysztof September 22, 2021

Myself concludes from exchange made so far:  if title line of Confluence document with my anchor includes single quote characters following forms of Confluence anchor url have no chance to work:

http://myconfluence.com/display/spacekey/pagename#pagename-anchorname

https://MYDOMAIN.atlassian.net/wiki/spaces/MYSPACE/pages/123456/TestPage#anchor

https://myconfluence.com/wiki/spaces/MYSPACE/pages/123456/TestPage#anchor

https://myconfluence.com/wiki/spaces/MYSPACE/pages/123456#anchor

https://myconfluence.com/spaces/viewspace.action?key=~usernick

Instead I should concentrate on finding why following is not working

https://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page-anchor

It is so easy to lose quickly overview over all degrees of freedom on composing url. Why must it be of that complication level?

If document with my anchor is also a space why can't I use spacename-oriented url scheme?

If document title and content id address document unambiguously each why need some schemes to have both?

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 22, 2021

https://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page-anchor --> I have found this working for me.

We have freedom to choose name of the anchor but have to deal with the url created by confluence which is by design.

I would recommend raising it with Atlassian Support as they can better explain these questions.

DUDZIAK Krzysztof September 23, 2021

Thanks for input.

https://myconfluence.com/pages/viewpage.action?pageId=54689987#Test-page-anchor --> I have found this working for me.

Is your document also user's home document (user's space), or rather deep on documents tree?

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 24, 2021

Its not my home page but a document under some parent. However, the behavior is same irrespective of whether it is space's home page or any other page. 

DUDZIAK Krzysztof September 27, 2021

In such a case other constrains apply regarding document title / address. User home / space documents are guaranteed to have special characters in tittle. Only certain kinds of URL are working.

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 27, 2021

Yes there might be cases where few special chars might affect the functionality. Do you have any examples of special characters with which you are having issues ? May be I can try replicating that and see if the behavior is same.

DUDZIAK Krzysztof September 28, 2021

Isn't it that way Confluence is only party where user home / space document tittle scheme becomes defined? Isn't user nickname scheme's only parameter? If yes, scheme is expected to be commonly known. Scheme uses character "'" at one point in tittle.

I never had to set my Confluence home / space document tittle line on my own, Confluence did it kindly for me.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events