vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.21k stars 2.13k forks source link

External links cannot jump correctly when the base attribute is enabled #4365

Open ajiho opened 3 days ago

ajiho commented 3 days ago

Describe the bug

This is the sidebar configuration

themeConfig: {
sidebar:{
  "/en/": {
    "base": "/en/",
    "items": [
      {
        "text": "introduce",
        "items": [
          {
            "text": "Release log",
            "link": "releases"
          },
          {
            "text": "Upgrade",
            "link": "upgrade"
          },
          {
            "text": "foo",
            "link": "https://foo.com/"
          }
        ]
      }
    ]
  }
}
}

image

When I make some changes, it returns to normal

themeConfig: {
sidebar:{
  "/en/": {
    "items": [
      {
        "text": "introduce",
        "items": [
          {
            "text": "Release log",
            "link": "/en/releases"
          },
          {
            "text": "Upgrade",
            "link": "/en/upgrade"
          },
          {
            "text": "foo",
            "link": "https://foo.com/"
          }
        ]
      }
    ]
  }
}
}

image

Reproduction

unnecessary

Expected behavior

When I enable the base attribute, it allows external links in the submenu to be accessed normally

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz
    Memory: 1.34 GB / 7.91 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE      
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    vitepress: ^1.5.0 => 1.5.0


### Additional context

_No response_

### Validations

- [X] Check if you're on the [latest VitePress version](https://github.com/vuejs/vitepress/releases/latest).
- [X] Follow our [Code of Conduct](https://vuejs.org/about/coc.html)
- [X] Read the [docs](https://vitepress.dev).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.