vuepress icon indicating copy to clipboard operation
vuepress copied to clipboard

【vuepress】相对路径不添加"./"无法访问图片资源

Open c-wchen opened this issue 3 years ago • 2 comments

Bug report

Steps to reproduce

图片资源和md文件存放同级目录assets下,通过assets/img.png无法访问,而通过./assets/img.png却能访问

What is expected?

图片访问同时支持assets/img.png相对路径方式访问

What is actually happening?

资源无法访问

Other relevant information

Environment Info:

  System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  Binaries:
    Node: 12.9.1 - D:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.10.2 - D:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.37)
  npmPackages:
    @vuepress/core:  1.9.7
    @vuepress/theme-default:  1.9.7
    vuepress: ^1.9.7 => 1.9.7
  npmGlobalPackages:
    vuepress: Not Found

c-wchen avatar Jun 30 '22 16:06 c-wchen

assets/img.png will be resolved to the public directory, you can put them inside .vuepress/public and they will be copied to the root of the generated directory.

ref: Asset Handling > Public Files

ulivz avatar Jul 04 '22 08:07 ulivz

这样对于从其他平台迁移的博客是十分不友好的,可以考虑增加一个选项支持短路径模式

c-wchen avatar Jul 05 '22 01:07 c-wchen