Skip to content

Configuring the base as a CDN address will cause a hyperlink href exception #3132

@yangdan8

Description

@yangdan8

Describe the bug

Configuring the base as a CDN address will cause a hyperlink href exception

<a  class="title"
  href="http:/abc.cdn.cn/hello/"
  data-v-b817187b>
  <!--[--><!--]--><!----><!--[-->VitePress<!--]--><!--[--><!--]-->
</a>

Reproduction

// config.js

export default ({
    base: 'http://abc.cdn.cn/hello/',
});

// index.md

# hello
![](world.png)

// dist/index.html

...
<header class="VPNav" data-v-30b21250 data-v-04c31db4>
          <div class="VPNavBar" data-v-04c31db4 data-v-d8c1e712>
            <div class="container" data-v-d8c1e712>
              <div class="title" data-v-d8c1e712>
                <div class="VPNavBarTitle" data-v-d8c1e712 data-v-b817187b>
                  <a
                    class="title"
                    href="http:/abc.cdn.cn/hello/"
                    data-v-b817187b
                    ><!--[--><!--]--><!----><!--[-->VitePress<!--]--><!--[--><!--]--></a
                  >
                </div>
              </div>
...

Expected behavior

href="/"
or
href="http://abc.cdn.cn/hello/"

System Info

win11
chrome118
"vitepress": "1.0.0-rc.23"

Additional context

No response

Validations

Please review the following demo:
https://stackblitz.com/edit/github-tyb3oh-fjwkma?file=docs%2F.vitepress%2Fdist%2Findex.html
or
https://github.com/yangdan8/vitepress-bug.git

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions