Images ... still don't appear

After reading the docs, and about two dozen posts about difficulty getting images to show up, I still can’t get it to work the way I think it should (though if it’s just my thinking that’s wrong I’m fine with that too).

My understanding is that content in /static is supposed to be served at the root of the site.

Here are the deets:

  • Assume a page at /content/
  • Assume an image at /static/img/bar.jpg

And my results, based on code in the aforementioned

  1. ![works](../img/bar.jpg) : This is a “textbook” relative link. Should work, and does.
  2. ![doesn't work](/img/bar.jpg): Based on other posts here, I didn’t expect this to work because of the leading /, and indeed it doesn’t.
  3. ![doesn't work either](img/bar.jpg): However, I thought removing that / should work, but it doesn’t.

Question: What’s the “right” way to make an absolute link to an image at /static/img/bar.jpg from a page at /content/


The “right” way is your example #2, which works fine for me.

Please post a link to the public repository for your site. See:

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.