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

Links to pages outside "base" path scope do not work #458

Closed
3 tasks done
aantipov opened this issue Dec 3, 2021 · 2 comments
Closed
3 tasks done

Links to pages outside "base" path scope do not work #458

aantipov opened this issue Dec 3, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@aantipov
Copy link

aantipov commented Dec 3, 2021

Describe the bug

I have the following site structure

image

/blog is powered by VitePress (I set base: '/blog/' in /blog/.vitepress/config.js)

The problem is that links from /blog pages to other pages of the website do not work

image

I checked the console and saw 404 for js bundles. And no document requests

Reproduction

Described above

Expected behavior

Links to pages pages outside /<basePath>/ should work.

As I understood, VitePress treats all the links under / as internal and applies routing and prefetching.
This is the root of the problem.
Scoping routing and prefetching to /<basePath>/ should fix the problem.

Here is where an additional check for basePath is needed for Router
https://github.com/vuejs/vitepress/blob/main/src/client/app/router.ts#L125
image

Here is where an additional check for basePath is needed for preFetch https://github.com/vuejs/vitepress/blob/main/src/client/app/composables/preFetch.ts#L83
image

System Info

System:
    OS: macOS 11.6
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 323.38 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.4 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Browsers:
    Brave Browser: 95.1.31.88
    Chrome: 96.0.4664.55
    Firefox: 90.0.2
    Safari: 15.1

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@aantipov aantipov added the bug: pending triage Maybe a bug, waiting for confirmation label Dec 3, 2021
@kiaking
Copy link
Member

kiaking commented May 23, 2022

Interesting. Haven't thought about this usage but we might need this.

@kiaking kiaking added enhancement New feature or request and removed bug: pending triage Maybe a bug, waiting for confirmation labels May 23, 2022
@brc-dd
Copy link
Member

brc-dd commented Jun 29, 2022

Refer #502 (comment) -- scheme://path is required if linking to any external link (including links outside the base).

@brc-dd brc-dd closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 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
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants