HTML Build a Blog with Jekyll and GitHub Pages Hosting with GitHub Pages Project Pages Websites

jessica grinberg
jessica grinberg
14,117 Points

my images won't display since I deployed the repo to project pages

hi, my images won't display since I deployed the repo to project pages, any clue on how to fix it?

3 Answers

Ran ShemTov
Ran ShemTov
14,148 Points

In your question, there are abosolutely no clues that will help us understand the question better.

However, i'd assume it has something to do with the path specified to the images. So, as first step, i would suggest checking the "src" attribute seeing these aren't only relative to your local environment (your computer).

jessica grinberg
jessica grinberg
14,117 Points

I am sorry, thanks for your help! Yes it is definitely a path issue. Once I deployed the website I modified _config.yml with the following:

baseurl: '/classcodedesign'
url: "http://jessgrinberg.com" 

and my image tag looks like this:

    {% if page.image %}
    <img class="feat-img is-hidden-mobile" src="/img/{{ page.image }}">
    {% endif %}

Do you see any mistake?

Thanks!

jpihlk
jpihlk
26,543 Points

Same thing happened to me. I was able to fix it in the page.image loop by adding "{{site.baseurl}}" to the src attribute:

 src="{{site.baseurl}}/img/{{post.image}}

I have the same problem. When I copied all the files into my github it didn't copy the _site file for some reason. Do I need that file to display the image?