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

Base paths (and links) not generating correctly for nested pages. #252

Closed
songololo opened this issue Feb 28, 2021 · 3 comments · Fixed by #502
Closed

Base paths (and links) not generating correctly for nested pages. #252

songololo opened this issue Feb 28, 2021 · 3 comments · Fixed by #502
Labels
bug: pending triage Maybe a bug, waiting for confirmation

Comments

@songololo
Copy link

Describe the bug

See https://github.com/songololo/vitepress-debug for reproduction of this issue:

Run a dev server: yarn docs:dev.

Note that the base-path /my-base-path/ is set in the config at .vitepress/config.js.

The base path works for root files, i.e. index.md is served from /my-base-path/.

However, the base path is missing for nested files, i.e. content/index.md is served from /content/ and content/hello.md is served from /content/hello.html.

This doesn't break things in development mode because the links are also missing the base path.

However, it breaks things in production because the links are missing the base path.

System Info

  • vitepress 0.12.2
  • vite/2.0.4
  • darwin-x64
  • node-v15.8.0

This happens for both my local system and for a github actions build.

@songololo songololo added the bug: pending triage Maybe a bug, waiting for confirmation label Feb 28, 2021
@songololo
Copy link
Author

PS - this may be a links issue, for example:

  • When following the link /content/ path from the home page, it will send to (and serve from) /content/
  • But if you try to go to /content/ manually, then it will give a warning: The server is configured with a public base URL of /my-base-path/ - did you mean to visit /my-base-path/content/ instead?
  • Manually inserting /my-base-path/ into the link works as intended, for example a link to /my-base-path/content/ will send to (and serve from) /my-base-path/content/.

I'm assuming that the intended behaviour is that links described without /my-base-path/ should automatically include the base path when resolving?

For now I'm inserting the base path into all links as a workaround.

@Alsmile
Copy link

Alsmile commented Dec 22, 2021

+1

The server is configured with a public base URL:/my-base-path/
Markdown link: [a](/a)
I want to visit [hostname]/my-base-path/a, not [hostname]/a

@Alsmile
Copy link

Alsmile commented Dec 23, 2021

+1

The server is configured with a public base URL:/my-base-path/ Markdown link: [a](/a) I want to visit [hostname]/my-base-path/a, not [hostname]/a

It can be solved as follow:
[bar - three](../bar/three)

This was referenced Jan 19, 2022
yyx990803 pushed a commit that referenced this issue Feb 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: pending triage Maybe a bug, waiting for confirmation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants