Creating relative web links
Asked by marcofsinger:

Hi Community,

we are currently testing the "Open API (Swagger) Integration" (<https://marketplace.atlassian.com/apps/1219386/open-api-swagger-integration>) for Confluence.

Our idea was to create an API documentation in Confluence and adding links from overview pages to pages with details where this add-in is used. For this anchors are needed on the details page. I expected the add-in to create usable anchors. When analyzing the resulting DOM, I found out that there are anchors.

When adding a "Web" Links in Confluence it worked perfectly like this:  
<http://hostname:8090/display/MSIN/Sub+Page+1#/default/testEndpoint>

But I failed to find a way not using a "Web" Link but and "Advanced" Link with a relative link approach (only specifying sub page and anchor).

It seems when using the "Anchor" makro in Confluence the resulting anchors always are name "pagetitle_anchorname". And of course the Link macro uses the same approach when using "Advanced" Link. But the mentioned add-in does not use this format.

Is there still any way to specify relative links to the sub pages with the details?

I hope I have described the problem understandably.

Thank you


Answers:
author: Tobias Tolle
body: I think I experience the same but would describe it differently:

<br />

Links to anchors work fine as long as the "Open API (Swagger) Integration" macro is not included in the page. As soon as I add it, the links to the anchors don't work anymore, they lead to the top of the page. Same with links to headers.

Note that this only happens when you come from another Confluence page. When you click on an entry in the content table of a page, this works. If you ctrl-click on the link so that it opens in another tab, the link leads to the top of the page.

All colleagues that I have asked experience the same problem. Our IT helpdesk agent, who probably has more rights, does not experience the problem.

Anybody who can help?


author: Dominic Lagger
body: Hi [@marcofsinger](/t5/user/viewprofilepage/user-id/3004702)

I'm not sure whether I got it or not :)

First, I don't think, that there are any other options to use relative links.

But, You could use the "Content by label" macro. Just add the label in the detailed pages and in the overview, you could add the Content by label and there yout go, you have a list of all pages :)

Regards, Dominic

comments: author: marcofsinger
body: Hi Dominc,

thank you for the first reply :)

I cannot add labels to the details pages because the add-in creates the complete content from a Yaml API description.

An example can be found here: <https://toshihiro.atlassian.net/wiki/spaces/OASI/pages/353140737/Demo>

Regards, Marco


author: Dominic Lagger
body: You could add a label to the "Demo" page, couldn't you?


author: marcofsinger
body: No, I could not. The addin creates the complete page content, so I cannot create a label in between.


author: Dominic Lagger
body: So I'm really sorry, but then I don't get it...

As you described, you want an overview page, where you can link to different API's.

So you want to see on the overview page, that there exists a "petstore" and then you want a link to the petstore. In this case, you want to link to the Demo page: "<https://toshihiro.atlassian.net/wiki/spaces/OASI/pages/353140737/Demo>"

And on this Demo page, you can add a label at the bottom right (see printscreen --\> "No labels".

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/183388iDA55D4A4BAEDF928/image-size/large?v=v2&px=999 "image.png")

Do I misunderstand something?


author: marcofsinger
body: I want to link to a specific part of the existing content, like to the description of /store/inventory. I don't want to add labels at the page.

Normally works like <https://toshihiro.atlassian.net/wiki/spaces/OASI/pages/353140737/Demo#/store/inventory> - unfortunately on this demo page it does not work, but works on our test server.

When using full web links this also works with our test server but not with "Advanced" links (relative links)


author: Dominic Lagger
body: Okay, got it.

So I don't know why the "advanced links" don't work but the normal links are working.


author: marcofsinger
body: Right, but it is absolutely not best practice to use full web links when referencing to a relative page... May lead to several problems.


Tags: app

confluence-server

link

server