-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Links to public/ files are wrong when a base URL is used #1806
Comments
This reverts commit 8e1ca4b. In theory, we should be able to put this file in the public/ directory and link it using an absolute path like /SVG-foo.json , but that doesn't work when a docroot is used. This is a bug in VitePress, which I've filed as vuejs/vitepress#1806 In the meantime, using a relative path works around this issue. Change-Id: I86367455eea49766090c5cdfe74f8da6b2514731
I tested it multiple times and can confirm that absolute paths of links base: '/TEST/', // config.ts 
[JSON ABSOLUTE](/foo.json)
[JSON RELATIVE](./foo.json) From the docs
I have not looked into the building process of the routes, but I assume that an easy fix would be to add the |
The problem here is do we know if you're writing /foo.json, it is going to be internal 👀. What if someone wants to have a file at foo.com/bar.json and have vp deployed at foo.com/baz/ and we prefix that link so that it becomes foo.com/baz/bar.json, in this case that link will break, won't it 👀 |
@brc-dd True, even If I think it is more desireable to construct a link which includes a basepath. If you really want to point to an external file you should use an url I could take a deeper look at this if you find this worth changing @brc-dd |
Sure, and there should be a way to link to something at the domain root if I really want to (perhaps by using a URL like @MarkusKeck) suggests. But the reason I was expecting it to work the way I described in my bug report is because VitePress's own documentation says that it should:
There's no caveat here along the lines of "except if you're using a base path, then this doesn't work". At the very least the documentation should be updated so that it correctly describes the actual behavior. But I'd argue for fixing this bug, or providing some other way of reliably linking to |
Here is a quick update on the error that is occurring. I have already read deeper and found a working fix. However, I have noticed that there are many individual exception rules for different links, which then contain additional exceptions depending on the environment. For this reason, I think it makes sense to invest some more time in a solution that is satisfactory and consistent for all types of links. @catrope If it is interesting for you or you want to have a quick solution for the currently occurring behavior, you are welcome to take a look at the current handling of links in Vitepress. |
foo.json
in thepublic/
directory.md
file somewhere, create a link like[look at this JSON file](/foo.json)
base: '/base/
/foo.json
, but it should point to/base/foo.json
The text was updated successfully, but these errors were encountered: