Image linking

I am having an issue with linking images. I am using Hugo on my local Linux machine, and I have set up my site with the theme, etc. I am creating a new post with the markdown file and added all the content. However, when I try to link the images using the following method, and run the local server to display the page, I get the text but no image is displayed. I have tried specifying multiple different paths, but I am still encountering the same issue.

image

All of the image files are in the static/images folder and I have looked online and most people are either using “(images/xxx.png)” or just the image file name “(xxx.png)”. And all spellings have been checked and names even changed as a test, even using different file format for images.

Does anyone know what I’m doing wrong?

What’s your baseURL in the configuration file?

I pre-set it to my domain. Also I’m getting the same even after I have put the site into Github pages.

A URL without a leading slash is relative to the current page.

A URL with a leading slash is relative to the server root.

Just noticed you said the images are in the static folder! For that, you will need to add a leading slash as Joe suggested. [image](/image/test.jpg).

Well that’s embarrassing because Im pretty sure I did this like two days ago. Either way that works. So I appreciate the help from both of you @jmooring @Arif, Thank you!

That is incorrect. Either way may work on the home page, because both resolve to a file in the server root.