Github页面上的图像路径损坏(没有Jekyll) [英] Broken image paths on Github Pages (without Jekyll)
问题描述
我最近将一个静态HTML网站推到了Github Pages.由于它不是博客,因此我选择不使用Jekyll.现在,当然,我所有的相对图像链接都已断开,并且我还没有找到Jekyll特有的修复程序.
I recently pushed a static HTML site to Github Pages. Since it's not a blog, I opted not to use Jekyll. Now, of course, all of my relative image links are broken, and I've yet to find a fix that isn't specific to Jekyll.
- 有任何解决办法吗?
- 一旦我从username.github.io URL切换到自定义URL,该修补程序是否将继续起作用?
推荐答案
不确定我在这里是否正确理解了这个问题,但是您不能只将图像移到相关位置吗?例如,如果您在index.html
中拥有
Not sure if I'm understanding the question correctly here, but could you not just move the images to the relevant place? For example, if in index.html
you had
<img src="images/photo.png">
您是否可以将photo.png
移至与index.html
相同的文件夹中的目录/images
?
could you not just move photo.png
to a directory /images
in the same folder as index.html
?
或者,您可以更改img
标记的src
属性,使其指向相关位置.
Alternatively, you could change the img
tags' src
attribute to instead point to the relevant location.
只要图像与html文件位于同一目录或该目录的子目录中,这两种方法都将继续起作用.
Both of these would continue to work, so long as the images are in the same directory as the html file, or a subdirectory of that directory.
这篇关于Github页面上的图像路径损坏(没有Jekyll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!