Search code examples
jekyllgithub-pages

Assets not found on GitHub Pages Jekyll Blog


I am using the minima theme for jekyll. I want to add images to my posts. In _config.yaml I have baseurl set to /blog and url set to https://mywebsite.combecause my jekyll blog is a separate repo that is accessed by mywebsite.com/blog. In the post I want to include the picture in I have

<figure>
  <img src="{{ site.baseurl }}/assets/pihole.png" alt="PiHole Dashboard"/>
  <center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>

This works fine on my local, but when deploying to github pages the picture is not there. I can access mywebsite.com/blog/assets/main.css no problem, but when I try to access the image it gives me a 404.

Inspecting the page shows me that it does have the correct location

figure>
  <img src="/blog/assets/pihole.png" alt="PiHole Dashboard" />
  <center><figcaption>PiHole Dashboard.</figcaption></center>
</figure>

Is there something I am missing that is not uploading my image file to GitHub Pages?


Solution

  • Needed to create an assets folder in my root directory and place the files there.