Search code examples
jekyllgithub-pagesjekyll-theme

Why doesn't the post picture load if the extension is name_of_pic.JPG?


The top of my .markdown file in the jekyll theme is as follows:

---
layout: post
title: xyz
description: xyz
img: /img/1.JPG
---

The picture does not load if the extension is .JPG, even though the picture's extension in the _img/ folder is .JPG

It works if the extension in the code is changed to .jpg.

Everything works fine when I jekyll serve it locally but this happens when I push my changes to github and try to view my changes on github pages

I could do a patch up like this everywhere but I would like to understand why I have to do this.


Solution

  • I've just tested your code on this forked repository.

    If I test this locally or on github-pages, this is how things are going :

    | _portofolio file |  image name  | front matter | HTTP status   |
    ------------------------------------------------------------------
    | 1_project        |  1.jpg       |  1.jpg       | 200 OK        |
    | 2_project        |  2.jpg       |  2.JPG       | 404 Not found |
    | 3_project        |  3.JPG       |  3.jpg       | 404 Not found |
    | 4_project        |  4.JPG       |  4.JPG       | 200 OK        |
    

    All those results are due to both local and github webservers case sensitivity. Upper cased letters are not considered to be equal to lower cased letters (a!=A).

    For Why case-sensitivity ? see this question on stack webmaster.

    And this :

    The picture does not load if the extension is .JPG, even though the picture's extension in the _img/ folder is .JPG

    is supposed to work, just like in our fourth test case.