# Is there a simple way to display images in hugo?

**URL:** <https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627>\
**Category:** support\
**Tags:** obsidian\
**Created:** [May 4, 2024, 4:04am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627 "2024-05-04T04:04:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![oslon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oslon/32/21423_2.png) [@oslon](https://discourse.gohugo.io/u/oslon)\
**Post date:** [May 4, 2024, 4:04am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/1 "2024-05-04T04:04:49Z")

</div>

` ![1](../../static/images/1.png)`  
I put the images in static/images folder and link it like this. In vs code, I can view them, but i can’t see them when I run hugo serve and see the output at localhost:1313. WHy?

I earlier tried to put them in content/images directory and same issue occurred.

---

<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:** [May 4, 2024, 4:09am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/2 "2024-05-04T04:09:43Z")

</div>

If you place your images in the static/images directory, and if your baseURL does not include a subdirectory, do this:

```auto
![alt](/images/image.jpg)

```

[https://gohugo.io/getting-started/directory-structure/#directories](https://gohugo.io/getting-started/directory-structure/#directories)

> **static**  
> The static directory contains files that will be copied to the public directory when you build your site.

And it looks like we have answered your question before:  
[https://discourse.gohugo.io/t/inserting-image-into-post-by-putting-it-under-static-folder-isnt-working/49567/3](https://discourse.gohugo.io/t/inserting-image-into-post-by-putting-it-under-static-folder-isnt-working/49567/3)

---

<div class="post-metadata">

**Author:** ![oslon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oslon/32/21423_2.png) [@oslon](https://discourse.gohugo.io/u/oslon)\
**Post date:** [May 4, 2024, 4:35am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/3 "2024-05-04T04:35:01Z")

</div>

What should the baseurl be?

---

<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:** [May 4, 2024, 4:36am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/4 "2024-05-04T04:36:26Z")

</div>

See docs:  
[http://localhost:1313/getting-started/configuration/#baseurl](http://localhost:1313/getting-started/configuration/#baseurl)

---

<div class="post-metadata">

**Author:** ![oslon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oslon/32/21423_2.png) [@oslon](https://discourse.gohugo.io/u/oslon)\
**Post date:** [May 4, 2024, 4:42am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/5 "2024-05-04T04:42:49Z")

</div>

Got it boss. This is so uninituitive. I can’t seem to see where the image is in obsidian. What I do is paste images in obsidian, set the directory to default static/images where attachments are kept. But now I need to manually rewrite the URLs.

---

<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:** [May 4, 2024, 4:46am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/6 "2024-05-04T04:46:42Z")

</div>

> [@oslon](#):
>
> obsidian

Search this forum for “obsidian”. I solved this problem before… it’s a matter of configuration.

---

<div class="post-metadata">

**Author:** ![oslon](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/oslon/32/21423_2.png) [@oslon](https://discourse.gohugo.io/u/oslon)\
**Post date:** [May 4, 2024, 4:50am UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/7 "2024-05-04T04:50:05Z")

</div>

Ok doing it rn. This is bookamrked.

---

<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:** [May 4, 2024, 1:18pm UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/8 "2024-05-04T13:18:19Z")

</div>

Obsidian configuration:

```plaintext
{
  "attachmentFolderPath": "attachments",
  "useMarkdownLinks": true,
  "newLinkFormat": "absolute"
}

```

Hugo configuration:

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

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

[[module.mounts]]
source = 'assets'
target = 'assets'

[[module.mounts]]
source = 'attachments'
target = 'assets/attachments'

```

The attachments directory in the root of your project might look something like this:

```plaintext
attachments/
├── documents/
│ ├── a.pdf
│ └── b.pdf
└── images/
    ├── kitten-a.jpg
    └── kitten-b.jpg

```

Example:

```plaintext
git clone --single-branch -b hugo-forum-topic-49627 https://github.com/jmooring/hugo-testing hugo-forum-topic-49627
cd hugo-forum-topic-49627
hugo server

```

And this is a really stupid limitation in Obsidian:

[https://forum.obsidian.md/t/start-absolute-path-with-a-leading-slash/32501](https://forum.obsidian.md/t/start-absolute-path-with-a-leading-slash/32501)

They need to fix that to provide compatibility between Obsidian and VS Code Markdown Preview mode.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [May 6, 2024, 1:18pm UTC](https://discourse.gohugo.io/t/is-there-a-simple-way-to-display-images-in-hugo/49627/9 "2024-05-06T13:18:39Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
