feat: 希望能通过相对路径访问资源 #175
Unanswered
WindowsXp-Beta
asked this question in
Q&A
Replies: 1 comment
-
markdown文件的图片链接如果设置为 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
当想要部署到不同的domain时,比如国外国内双线访问,那么修改config.yaml中baseURL的方式便不太好,因为这样的话资源(比如CSS,图片等)还是会从一个地方获取。Hugo提供了relativeURLs这个参数可以将url变成相对url,此时需要将baseURL设置为空。设置后在生成的html header中的资源就已经变成相对路径了,比如从原来的
https://username.github.io/css/eureka.min.css
变为./css/eureka.min.css
。但是在Markdown的header部分定义的资源,比如img/avatar.png
从原来的https://username.github.io/img/avatar.png
变为了img/avatar.png
从而导致图片加载失败。Describe the solution you'd like
希望对于文章中使用的资源能够生成相对路径访问。
或者提供一些其他双线部署的方法?
Beta Was this translation helpful? Give feedback.
All reactions