Images in posts (Papermod)

I get this broken image when I use this format,

This is my markdown code:

Some of my last moments in the game: 

![](/static/img/Screenshot%20(33).png)

Below, I’ve embedded the soundtrack. Feel free to give it a listen:

Hello, most likely the problem is that you’re referencing

![](/static/img/Screenshot%20(33).png)

but it should be

![](/img/Screenshot%20(33).png)

Everything in the static folder starts from the site root.

1 Like

As @icedogas mentioned and additionally it depends on the baseURL

better modern approach: store the images in assets or at page level.

PaperMod uses an image render hook so you can do:

  • with this structure

    ├───assets
    │   └───images
    │           asset.png
    ├───content
    │   │   _index.md
    │   └───post-1
    │       │   bundle.png
    │       │   index.md
    │       └───subdir
    │               bundle.png
    └───static
       └───img
                static.png
    
  • you may reference the images in/content/post-1/index.md as

    ![](bundle.png)
    ![](./bundle.png)
    
    ![](./subdir/bundle.png)
    ![](subdir/bundle.png)
    
    ![](/images/asset.png)
    ![](images/asset.png)
    

if for any reason, you have or want to keep the static folder

  • add this to hugo.toml

    [module]
      [[module.mounts]]
        source = 'assets'
        target = 'assets'
      [[module.mounts]]
        source = 'static'
        target = 'assets'
    
  • and reference the images as

    ![](img/static.png)
    ![](/img/static.png)
    

all these work regardless how your baseURL looks like


btw I wouldn’t use parens () in filenames

1 Like

![](/img/Screenshot%20(33).png)

Still nothing :frowning:

This worked! Thanks!