Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Relative links are rendered as relative to a file and not a directory #1547

Closed
mkende opened this issue Feb 29, 2020 · 6 comments
Closed

Relative links are rendered as relative to a file and not a directory #1547

mkende opened this issue Feb 29, 2020 · 6 comments
Assignees
Labels

Comments

@mkende
Copy link

mkende commented Feb 29, 2020

Describe the bug
Note: this is similar but different from issue #1543.

The name of the current page is prepended to a relative mark-down link after rendering (instead of only prepending the current directory).

To Reproduce
Steps to reproduce the behavior:

  1. Go to any markdown page except the home-page (e.g. /test.md)
  2. Create a relative markdown link (e.g. test
  3. Observe that in the preview-pane the link correctly points to /dir/foo.
  4. Render the page and observe that the link now points incorrectly to /test/dir/foo.

Expected behavior
The behavior after rendering should be the same as the preview.

Host Info (please complete the following information):

  • OS: Debian stable
  • Wiki.js version: 2.1.113
  • Database engine: SQLite
@despens
Copy link
Contributor

despens commented Mar 4, 2020

Similar to #1201

@playerla
Copy link

I can confirm my relative links are rendered absolute links, with name of the current page prepended to them. Relative links are used in preview and allow to navigate between pages in edition mode. Rendered relative links should work the same way.

@rongcuid
Copy link

Confirm on a new installation. All relative links are unusable right now.

@mkende
Copy link
Author

mkende commented Apr 18, 2020

This is still happening on 2.2.51: relative links work correctly in preview mode, but they are rendered as if the current file was part of the path (so a link to "foo" inside a file "bar/baz.md" will be rendered to "bar/baz/foo" instead of just "bar/foo").

This is quite a problem as relative links are a very standard feature and rewriting them all to absolute links is not always easy (and makes moving files around in the future more difficult).

@mkende mkende changed the title Relative links are rendered incorrectly Relative links are rendered as relative to a file and not a directory Apr 18, 2020
@mkende
Copy link
Author

mkende commented Apr 18, 2020

Note that I just found the "treat relative links as root absolute" configuration option in the "html -> html" pipeline. The description of that option is the following: "For example, a link to foo/bar on page xyz will render as /foo/bar instead of /xyz/foo/bar."

That description seems to imply that the current behaviour would be expected. It still seems to be at odd with any other markdown rendering system, and is also not how wiki.js itself renders the links in preview mode.

@NGPixel can you tell us if the current behaviour is intended or if it's considered a bug?

@mkende
Copy link
Author

mkende commented Nov 22, 2020

This is still here in 2.5.170. Is there any chance to get a comment on whether this issue is considered to be a bug or a feature, even if it can't be fixed now?

This is a very fundamental part of the wiki so it would be great to know what is the behaviour that we can rely on going forward (the one from the preview pane, or the one after rendering)?

@NGPixel NGPixel closed this as completed Mar 21, 2021
@requarks requarks locked and limited conversation to collaborators Mar 21, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

5 participants