Broken image paths on Github Pages (without Jekyll)

那年仲夏 提交于 2019-12-24 06:45:41

问题


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.

  1. Any ideas for a fix?
  2. Will that fix continue to work once I switch from the username.github.io URL to a custom URL?

回答1:


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">

could you not just move photo.png to a directory /images in the same folder as index.html?

Alternatively, you could change the img tags' src attribute to instead point to the relevant location.

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.



来源:https://stackoverflow.com/questions/31611969/broken-image-paths-on-github-pages-without-jekyll

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!