Why my image won't show up?

I’m having problem with add jpg image.

I put jpg file at [static] folder. and I type this

 ![Some Text](/myImage.jpg)

And This is my html sorce code

<img src="/myImage.jpg" alt="Some Text"></p>

I’m affraid to ask this becase I think this is common question but I couln’t figure out.
I researched and tried but I doen’t work. Could someone teach me how to solove this?

Maybe your image has the wrong file rights.

Have you tried something like

chmod 644 myImage.jpg
1 Like

Thank you very much for helping me :smiley:

I did what you taught me. but nothing changed…
But I just could display JPG data using below code.


Before I here to ask this question I already set correct baseURL

  baseURL = "https://mywebsite.net/hugo/vs/public"

I just wondering why I set right baseURL but I need to have to write
whole jpg path?

I don’t think that’s supposed to be the correct baseURL.

Also, could you test this?

<img src="{{ "myImage.jpg" | relURL }}" alt="Some Text">

If you want to learn more, please check the documentation about relURL.

1 Like

Thank you for helping me.

My baseURL isn’t correct? I can display everything without image so I thoguth this is correct.
Actually I don’t have domain for this hugo project .I just run hugo as test my rental server. location is
[vs] dir.

And I tried your code. however image won’t show up. just This code displaied.

Uh? Why aren’t you using the Hugo webserver?

1 Like

I use hugo webserver too . http://localhost:1313/
if webiste looks fine then I upload my rental server. so I use both.

About your code

<img src="{{ "myImage.jpg" | relURL }}" alt="Some Text">

About your img code.
I checked both server but it just display as text.

Are you really sure you’re replacing the <img src="/myImage.jpg" alt="Some Text"> with the code I posted in the layout html file?

Sorry, but I can’t do much without seeing the actual files. I’m basically shooting in the dark.

AFAIK, your problems seem to be related to relative paths. If you were using the "https://mywebsite.net/" as your baseURL and wanted to show the "https://mywebsite.net/hugo/vs/public/1.jpg" in a page called "https://mywebsite.net/whatever/", you would need to use a relative path, like ![1.jpg](../hugo/vs/public/1.jpg) or use something like the absURL/relURL function. But then again I don’t know your project structure.

1 Like

I wrote <img src="/myImage.jpg" alt="Some Text"> at .md file.

I understand that. Thank you very much for kindness.
I will get domain and change my baseURL and test.
I learned alot from you. Thank you.

1 Like

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