Forums

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

Creating relative web links

marcofsinger February 13, 2022

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

 

2 answers

0 votes
Tobias Tolle January 6, 2023

I think I experience the same but would describe it differently:


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? 

0 votes
Dominic Lagger
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.
February 13, 2022

Hi @marcofsinger 

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

marcofsinger February 13, 2022

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

Dominic Lagger
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.
February 14, 2022

You could add a label to the "Demo" page, couldn't you? 

marcofsinger February 14, 2022

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

Dominic Lagger
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.
February 14, 2022

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

Do I misunderstand something? 

marcofsinger February 14, 2022

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)

Dominic Lagger
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.
February 14, 2022

Okay, got it.

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

marcofsinger February 15, 2022

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events