Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "/wiki" segment when relative confluence link is resolved #468

Closed
wants to merge 1 commit into from

Conversation

st-karol
Copy link

  1. There are two pages documented: page1.md (title Title1) and page2.md (title Title2).
  2. page2.md links to page1.md by [link text](page1.md)

We've noticed that when relative link is used, because the linked page already exists on confluence, relative link rendered in confluence has the following form: /spaces/~spaceId/pages/number/Title1. That results in the following html representation <a data-testid="link-with-safety" href="/spaces/~spaceId/pages/number/Title1" title="/spaces/~spaceId/pages/number/Title1" data-renderer-mark="true" class="cc-1rn59kg">link text</a>.

In our case base url is https://[company-name].atlassian.net/wiki/. Once page2 with Title2 is rendered in the browser, link points to https://[company-name].atlassian.net/spaces/~spaceId/pages/number/Title1 instead of https://[company-name].atlassian.net/wiki/spaces/~spaceId/pages/number/Title1

This PR makes fixes the situation. It would be great if you could have a look and merge it if that is a behaviour across all confluence relative linking.

link = page.Links.Full
// Without /wiki prefix confluence renders broken links when page already exists.
link = fmt.Sprintf(
"/wiki%s",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is going to work with Confluence Server.

Copy link
Author

@st-karol st-karol Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to adjust to server version, but don't have access to such setup. Open for any suggestion here to make it work in both cases 🙏

We could try to identify it based on base url, but I'm not sure how it looks like in server setup.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, I'd probably revert it back to absolute URL instead, so reverting #457

@mrueg
Copy link
Collaborator

mrueg commented Jul 25, 2024

Should be resolved in #469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants