问题
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.
- Any ideas for a fix?
- 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