According to Hugo’s documentation, to reference an image, place the image in the static folder, and then reference the image in md with the static folder as the root.
Now I place img.png in the static folder and reference it in md like this:
! [img](/img.png)
Using hugo server, the link opens and the image is displayed correctly.
I also tried to change the configuration file for github action. hugo’s official configuration file build steps are:
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
I tried to change it to:
- name: Build with Hugo
env:
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/Sample-Blog/"
But this instead makes the paths to the other resources wrong.
I use reimu theme, and the author of the theme said that the images in the markdown are not processed in any way, everything is handled in the same way as in hugo.
The website is a single language, single-host site.
If the image placed in a page bundle, the link to the image is correct both locally tested and on github pages.
If the image placed in “static” folder, the link to the image still not correct on github pages, although I have enable Hugo’s embedded link and image render hooks in my site configuration: