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

Relative image/attachement links #163

Closed
Kilidsch opened this issue Nov 7, 2024 · 3 comments
Closed

Relative image/attachement links #163

Kilidsch opened this issue Nov 7, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Kilidsch
Copy link

Kilidsch commented Nov 7, 2024

Hey,

Otterwiki seems like a great project and we want to switch to it from our old wiki.
During the switch I noticed something:

In the preview, relative links to images worked, i.e. if I upload an image as an attachement for a page and add a relative image-link, the image is displayed correctly. On the finished page, the image is not displayed. To be displayed on the finished page, an absolute link is required.

So the question: Are relative links to attachements supposed to work?

@Kilidsch
Copy link
Author

Kilidsch commented Nov 7, 2024

Ok, after thinking about it a bit here is what I think happens:

Otterwiki just pastes the link form the image link into an image tag. So we get

<img src="relative-path.jpg" />

This assumes it is in the same directory, so if this is on page www.my-otterwiki.com/chapter/page it tries to load www.my-otterwiki.com/chapter/relative-path.jpg. When editing, the link changes to www.my-otterwiki.com/chapter/page/edit, which leads the relative img-tag to search in www.my-otterwiki.com/chapter/page; which is coincidentally correct.

This probably means it is not supposed to work in either. And while a relative link pagename/relative-path.jpg would work, it would break in preview. So relative paths are just not supported properly.

@redimp
Copy link
Owner

redimp commented Nov 7, 2024

Hey @Kilidsch, thank you for bringing this up.

It would be nice to be able to reference attachments not with the full path,

e.g.

![](/Example/a/example.png)

but relative:

![](example.png)

or

![](./example.png)

Currently the renderer knows nothing about the path of the page it's rendering, will have to look into it to find a nice solution.

@redimp redimp added the enhancement New feature or request label Nov 7, 2024
redimp added a commit that referenced this issue Nov 16, 2024
@redimp
Copy link
Owner

redimp commented Nov 17, 2024

Released in v2.8.0.

@redimp redimp closed this as completed Nov 17, 2024
eifelmicha pushed a commit to Schmitzis/otterwiki that referenced this issue Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants