.jpg vs JPG?

Is there a reason why when trying to use an image I have to use .jpg (.JPG does not work) in the markdown file, while I must use .PNG in markdown (.png does not work). Is this just something everybody knew about and I just now found out, or do I have something else going on?

I was trying to get a featured image shortcode to work, but saw exact same problem duplicate when I was just trying to display image with normal markdown in a post (not featured image, no shortcode).

This is on my local host, tried with several browsers, same results on each. I haven’t tried on live site, maybe it works differently there, but didn’t understand what the difference is.

I only found out this was the problem because despite path being correct in google element inspector, it would not load until I randomly started changing things and this was only cause I found to make it work.

Thanks all.

Please phrase this in the form of a Hugo specific-question. If you suspect something about Hugo is interfering with your files rendering, share the code and we’ll take a look.

If you need help debugging how to link to files by type and extension please search a web development resource. :slight_smile:

1 Like

jpg != JPG

File extensions are case sensitive.

Currently only jpg is allowed in Hugo.

You can always ask directly on GitHub, whether the uppercase extension can be allowed.

1 Like

Thanks. Curious how the .PNG image worked when I went to run the hugo server then if hugo only supports .jpg.

Thanks for the info about case sensitive, I was not aware of that.

After re-reading my original post, I guess I wasn’t clear but yeah this was a hugo specific question(in my head at least). My original question was written in markdown and then using hugo server command to run the site locally for testing. Sorry about not being clear.

I don’t currently have github, so I can’t share everything. I should probably do that if I’m gonna keep asking questions.

I did find my issue though. Thanks for the help.

Sorry for the multiple posts, I didn’t know how these forums worked and assumed it would nest it under your reply instead of putting it at the bottom like this. Didn’t mean to spam my own post.

Also wanted to say thanks to @alexandros stating his post, I went back and re-read more in the hugo docs about front matter.

I found my problem was I was in formatting of TOML. In the front matter, I was using:
image: "img/blog/controller.jpg"
When I should have been using:
image: "/img/blog/controller.jpg"

It seems like adding the extra / made all the difference. Without it, I found another problem where post image would load as featured image on my home page, but not on the individual /blog/ list page, I didn’t understand why but as soon as I added the extra / at the beginning all my problems were solved.

Sorry for a needless question, seems like no problems with hugo at all, just the user :slight_smile:

Neither was I.

This is something I found out first hand, because I receive images from several people to update a project every now and then. So I knew what you meant in your first post at first glance.

If memory serves me right the JPEG or jpeg extensions are also not supported.

I was not aware about the uppercase PNG extension working fine.

In any case as part of my workflow I typically lowercase all image extensions before using the images in Hugo.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.