Github pages' images not working #23086
-
I am still new to github pages overall and started playing with some items by creating an item through VScode CLI. any help? URL: amagalla1394/odin-recipe-git-test: The Odin Project Recipes project (github.com) the page itself is also up |
Beta Was this translation helpful? Give feedback.
Replies: 19 comments 42 replies
-
Hi there, welcome to the GitHub Support Community! The reason the images on your GitHub Pages site will not display is because you’re trying to call to the photos in a directory that does not exist. For example, in Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
I get that putting the images in the same directory would work much easier but isn’t it better practice to add images to a folder/directory of its own? if I am calling an image from lasagna.html for example… wouldn’t the image source path be ./images/lasagna.png ? or even add odin-recipe-git-test before the path? let me know if that makes sense or if i am missing something. thank you |
Beta Was this translation helpful? Give feedback.
-
You should be able to call back to the parent directory so you can pull the images from there. I’d say that’s good practice. Looking at your repository now, the reason the images won’t display is because there’s no period at the start of the specified path. Instead of: I tested it on my end and it fixed the issue. Hope this helps out! |
Beta Was this translation helpful? Give feedback.
-
I appreciate your help. Thank you |
Beta Was this translation helpful? Give feedback.
-
i did however end up placing the images in the same directory too though. i might test it later the other way |
Beta Was this translation helpful? Give feedback.
-
It solved the same problem I had and it looks like a very logical solution. 🧠 Thank you 🤝 |
Beta Was this translation helpful? Give feedback.
-
For me what worked was adding master to the start of the path "master/assets/images/" Since my branch was configured as Master |
Beta Was this translation helpful? Give feedback.
-
I think I'm having a similar issue, but I can't get my picture to show up. |
Beta Was this translation helpful? Give feedback.
-
same issue. Images are not showing up in readme. have tried everything. images can't open images in the image folder of any repo. it keeps loading. |
Beta Was this translation helpful? Give feedback.
-
I have changed the code And I go to the website looking for the DevTools, it shows up that there's no image folder in the source. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/pankajpuri/portfolio/tree/main/public/assests/images images are stored : public/assests/images/pankajpuri.jpg https://github.com/pankajpuri/portfolio/blob/main/src/components/profileSection.jsx Hi there, I have got react app. I deployed with gh-pages but I am unable to fetch images. |
Beta Was this translation helpful? Give feedback.
-
On Sat, Jun 10, 2023 at 1:12 AM Jane ***@***.***> wrote:
Github pages expect you to have an assets folder inside docs folder like
this docs/assets/ and add all your images thereGithub pages use jekyll so
it need to have the assets folder for images. Also jekyll can load
markdown content so if you select the root path it can load your
readme.md instead of looking for an index.html
—
Reply to this email directly, view it on GitHub
<#23086 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A5EQBP6NZEF75AECI2YSAUDXKP65BANCNFSM57GVNGVQ>
.
You are receiving this because you are subscribed to this thread.
i always create a file names Image but sometimes it’s work and sometimes he
doesn’t work
… Message ID: <community/community/repo-discussions/23086/comments/6138403@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
i can't see any images in any github pages . Is there any problem with my computer ? i tried with chrome and edge |
Beta Was this translation helpful? Give feedback.
-
One thing I realized is that the files stored as Untracking the files from git lfs and adding them as regular files worked for me. |
Beta Was this translation helpful? Give feedback.
-
I have read the whole discussion and other relevant articles and I still can't get my image to work on My website is now live: https://bigyajuu.github.io/my-portfolio/ and the images just would not show. I opened Inspect Element and the first thing I saw was the errors from the console: Incidentally, I found these error images are using the wrong URLs. From the Network tab of F12 menu you can see all these images lack the root folder |
Beta Was this translation helpful? Give feedback.
-
Ok. The problem I faced has something to do with the root of image paths. When hosting on your gh-pages you need to make sure the root is Inspect your error image files via Network tab of F12. Select your images and check the URLs. If done correctly, your path should include the entire gh-pages URL as root. e.g. Here is a duplicate on a StackOverflow query page I made: https://stackoverflow.com/questions/77624516/gh-page-hosting-parcel-v2-built-project-contains-static-image-assets-that-would. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Good post but I was wondering if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Appreciate it! skup samochodów dostawczych śląsk |
Beta Was this translation helpful? Give feedback.
You should be able to call back to the parent directory so you can pull the images from there. I’d say that’s good practice. Looking at your repository now, the reason the images won’t display is because there’s no period at the start of the specified path. Instead of:
<img src="/images/lasagna.png" alt="lasagna">
use
<img src="./images/lasagna.png" alt="lasagna">
I tested it on my end and it fixed the issue. Hope this helps out!