Images can not be loaded after deploy from Github

I’m a newbie to the front end and Netlify, recently I deployed my site from GitHub to Netlify, but the images can not be loaded, in the Chrome console, it says:
Failed to load resource: the server responded with a status of 404 ()

This is my site:
https://another-weibo.netlify.app/

GitHub repository:

I also deploy the same site manually, uploading the code folder locally. This time, the images can be loaded successfully. I don’t know why this happened.

the clone site which is deployed manually:
https://twimba-weibo.netlify.app/

@xph4444

#1

You should remove any references to twitter.
Especially within your site name, to prevent your account from getting suspended, see:

#2

The site cannot load files that you have not deployed.
The first image URL for example is images/troll.jpg
If you run your build you will see that it never puts the images in the output.

image

For how to fix it, see:

1 Like

Hi @nathanmartin, thank you for the reminder. I have already replaced the word ‘twitter’ with a safer alternative. Regarding the image issue, I have reviewed the documentation you provided and moved the images to the “public” folder. As a result, the images are now displaying successfully. Thank you!

that’s awesome! Glad to hear you were able to resolve your image issue! Thanks for writing back in and confirming your solution.

1 Like

@nathanmartin I attempted to apply the same method to a previous website of mine that also had issues loading images. I created a public folder and moved the assets into it, but this time it didn’t work. However, when I uploaded the project manually to Netlify, the images loaded successfully. I’m not sure why this is happening.

My site is:
https://oldagram-post.netlify.app/

The GitHub repository:

@xph4444 The files in your public/images folder are ending up in your dist.

You can confirm this by running your npm run build command locally then looking at the files.

What image isn’t loading?

The site should display 4 posts, each containing images and text. Currently, only one post is showing, and it’s hardcoded in the HTML. When I manually upload the project to Netlify, all the posts load successfully.
The manually uploaded site:
https://oldagram-manual.netlify.app/

The GitHub deployed version(only 1 post can be loaded):
https://oldagram-post.netlify.app/

@xph4444 I’ve not looked, but surely the number of posts that appear for your app has absolutely nothing to do with this thread and your previous issue.

@xph4444 View this previous post of mine, it answers the “why” of your current issue perfectly:

1 Like