[SOLVED] What's the image copying logic?

I don’t understand the logic of the copy of the image. Of course, I searched for info on this site but didn’t find an answer.
Here my question.
I create “content/afolder/test.md” and “content/afolder/image.png”. In test.md I add the line: ![an image](image.png). The markdown preview works well in my editor.
When Hugo generate the site, it moves image.png one directory level up relatively to test.html. This means I must modify test.md like this: ![an image](…/image.png) but this breaks the live markdown rendering.
Rem: I tried with different Themes (DocDock, Sam, …)
Is it possible to fix this issue? I want to keep together the document and the associated images. I want also that the preview works. Actually I just want to keep the same relative path in the site than in content.

Do you have “afolder” templates?
Change it to content/post/test/test.md
Put the image in content/post/test/

try again

No, I don’t have an “afolder” template.
I tried your suggestion but it doesn’t work.

Perhaps I’m doing something wrong with the site creation process. So here for more information.
I’m on Windows.

Here the installation process I use.

hugo new site Poc_Hugo
cd Poc_Hugo

I download the theme https://themes.gohugo.io/docdock/

I unzipp the theme docdock into the theme directory and rename the folder hugo-theme-docdock-master as hugo-theme-docdock.

I copy the content from Poc_Hugo\themes\hugo-theme-docdock\exampleSite to Poc_Hugo\

  • content\
  • layouts\
  • static\
  • config.toml

I comment out themesdir in config.toml

title = “DocDock Documentation”
theme = “hugo-theme-docdock”
#themesdir = “…/…”

hugo new test.md getting-start/test.md
Poc_Hugo\content\getting-start\test.md created

I add test.png
Poc_Hugo\content\getting-start\test.png

I modify test.md

+++
title = “Test”
+++
# TEST IMAGE
![test image](test.png)

I run the server

The site is well rendered except the page test. The image is not displayed. I must modify
test.md with this ![test image](…/test.png)
(of course, this breaks the preview in my editor)

When I create the static site :

Poc_Hugo\public\getting-start\test.png
Poc_Hugo\public\getting-start\test\index.html

The file test.png should be in the test directory.

It would be helpful for you to read the docs on page bundles: Page Bundles | Hugo

You need to create something like getting-start/test/index.md and put test.png under getting-start/test/

Yes, this is the answer I searched.
I think that hugo is the tool I searched for.
Thanks a lot for your help.