# Must all images be in the static folder

**URL:** <https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002>\
**Category:** support\
**Created:** [October 17, 2024, 12:29pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002 "2024-10-17T12:29:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grace](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/grace/32/23125_2.png) [@Grace](https://discourse.gohugo.io/u/Grace)\
**Post date:** [October 17, 2024, 12:29pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002/1 "2024-10-17T12:29:35Z")

</div>

Should all the images be in the static folder, or can they be post in any folder?

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [October 17, 2024, 12:52pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002/2 "2024-10-17T12:52:36Z")

</div>

No and yes.  
More info on that in the documentation under `Page bundles`

> **[Page bundles](https://gohugo.io/content-management/page-bundles/)**
>
> Use page bundles to logically associate one or more resources with content.

and

> **[Page resources](https://gohugo.io/content-management/page-resources/)**
>
> Use page resources to logically associate assets with a page.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 17, 2024, 1:31pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002/3 "2024-10-17T13:31:45Z")

</div>

It depends on the theme, the `baseURL`, etc.

If I were starting from scratch, creating my own layouts/theme…

Images related to a single page should be placed in a page bundle:

```plaintext
content/
├── posts/
│ ├── post-1/
│ │ ├── c.jpg <-- page resource
│ │ ├── d.jpg <-- page resource
│ │ └── index.md
│ ├── post-2.md
│ └── _index.md
└── _index.md

```

Images that can be used anywhere on the site should be placed in the assets directory:

```plaintext
assets/
└── images/
    ├── a.jpg <-- global resource
    └── b.jpg <-- global resource

```

And to make this setup work when adding images to your Markdown, enable Hugo’s embedded [link](https://gohugo.io/render-hooks/links/#default) and [image](https://gohugo.io/render-hooks/images/#default) render hooks in your site configuration:

```plaintext
[markup.goldmark.renderHooks.image]
enableDefault = true

[markup.goldmark.renderHooks.link]
enableDefault = true

```

The content/posts/post-1/index.md file would look something like this:

```plaintext
![a kitten](images/a.jpg) 

![another kitten](c.jpg)

```

Note that Hugo’s embedded link and image render hooks are automatically enabled for multilingual single-host sites.

---

<div class="post-metadata">

**Author:** ![chrillek](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/chrillek/32/19797_2.png) [@chrillek](https://discourse.gohugo.io/u/chrillek)\
**Post date:** [October 17, 2024, 2:18pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002/4 "2024-10-17T14:18:11Z")

</div>

Shouldn’t `another kitten` refer to `a.jpg` or `b.jpg` (from the page bundle)? Or perhaps using `a/b` for `assets` and `c/d` for the bundle would make the approach clearer.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 17, 2024, 2:20pm UTC](https://discourse.gohugo.io/t/must-all-images-be-in-the-static-folder/52002/5 "2024-10-17T14:20:43Z")

</div>

~~The file names are irrelevant.~~ I have fixed the tree diagrams above.

Resolution of the Markdown destinations is performed by the render hooks. The render hook documentation describes precedence.

- [https://gohugo.io/render-hooks/images/#default](https://gohugo.io/render-hooks/images/#default)
- [https://gohugo.io/render-hooks/links/#default](https://gohugo.io/render-hooks/links/#default)
