# Markdown images get wrong url

**URL:** <https://discourse.gohugo.io/t/markdown-images-get-wrong-url/51033>\
**Category:** support\
**Created:** [August 6, 2024, 1:22pm UTC](https://discourse.gohugo.io/t/markdown-images-get-wrong-url/51033 "2024-08-06T13:22:43Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [August 6, 2024, 1:52pm UTC](https://discourse.gohugo.io/t/markdown-images-get-wrong-url/51033/3 "2024-08-06T13:52:37Z")

</div>

You are serving your site from a subdirectory, which is fine, but this means that the host-relative URL to your image is `/samscorner/images/blog/suzanne.png`.

You could change your markdown accordingly, but if you change your hosting setup you would have to change all the markdown instances as well… this isn’t a great idea.

Instead, enable Hugo’s embedded link and image render hooks to properly resolve link and image destinations:

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

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

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

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

```

See:

- [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)

---

_[View the full topic](https://discourse.gohugo.io/t/markdown-images-get-wrong-url/51033)._
