After running hugo and uploading all of the content of public/ I have an issue with my images. Let’s say that the content of post1.md was
<figure>
<img src='image.png' alt='image' />
<figcaption>
my image
</figcaption>
</figure>
Then in the post itself <url>/posts/post1/ I can see the image since it links to <url>/posts/post1/image.png . However, if I am at the homepage ( <url> ) and I see the preview of my post, I cannot see the image, since it links to <url>/image.png .
What is the proper solution? (other than uploading 2 copies of the image)
ps: unrelated. I am a new user so I can’t replace <url> with example.com (thereby making it clear that it is a link). It might be nice to let new users posts more than 2 links if the link is example . com
However, like before, both formats result in the homepage preview linking to the nonexistent https://example.org/image.png and the post1 page linking to the working https://example.org/posts/post1/image.png
I did not modify image render hooks, because from my understanding, that can help modify things like its display size. However, at this point I want to work on it rendering in the first place.
What I ended up doing was adding themes/poison/layouts/_default/_markup_render-image.html with the content
{{ $img := .Page.Resources.GetMatch (printf "**%s" .Destination) }}
{{ if $img }}
<img src="{{ $img.RelPermalink }}" alt="{{ .Text }}" title="{{ .Title }}" loading="lazy" />
{{ if .Text }}<figcaption>{{ .Text }}</figcaption>{{ end }}
{{ else }}
<img src="{{ .Destination }}" alt="{{ .Text }}" title="{{ .Title }}" />
{{ if .Text }}<figcaption>{{ .Text }}</figcaption>{{ end }}
{{ end }}
The {{ if .Text }}<figcaption>{{ .Text }}</figcaption>{{ end }} was needed so that I could do  and make an image the caption rather than the hover over.
This seems to work, although I don’t know if this is the “proper” way (my assumption is that changes directly to theme should be avoided). If so, I will suggest that change to the poison theme.
The instructions that I provided work great. Try it:
git clone --recurse-submodules --single-branch -b hugo-forum-topic-54391 https://github.com/jmooring/hugo-testing hugo-forum-topic-54391
cd hugo-forum-topic-54391
hugo server
Indeed it does. Sorry for dismissing your solution earlier. I suspect that I did not properly save my code when I tried what you suggested. I will make sure to do so in the future.
I prefer using markdown images  over embedded figure shortcode {{< figure src=image.png caption="an image" >}} since that way my markdown IDE can render the images as well. So for now I think I’ll stick with my _markup_render-image.html file. But thank you so much for the reference.
Why is it that hugo (or poison) requires images to be written like so {{< figure src=image.png caption="an image" >}} rather than typical markdown ? It would seem to me to be better to use markdown, but I’m new to this, so it’s possible that I’m missing something.
hmm … I may be misunderstanding what you wrote then.
I raised my issue with images being displayed in posts, but not on the home page. You suggested {{< figure src=image.png caption="an image" >}} (not a native markdown function) to solve the issue. I would have preferred something like  (a native markdown function), however, in order to support that I modified _markup_render-image.html to create something not as per the standard. To avoid that I reluctantly used your suggestion.
I’m not sure what you meant by “IT DOESN’T”. Since it seems to me that in fact I do have to use embedded figure shortcode if I want to create proper html while displaying the image both on the home page and post.
I tried to modify the _markup_render-image.html file again, with
git clone --recurse-submodules --single-branch -b hugo-forum-topic-54391 https://github.com/jmooring/hugo-testing hugo-forum-topic-54391
cd hugo-forum-topic-54391
hugo server