How to fix image path in hugo post

If images are not displayed on your md page from static folder you need update base url.

Open file [themes/bilberry-hugo-theme/layouts/partials/header.html] Add following to ‘’ section:

<base href="{{ .Site.BaseURL }}">

Example:

{{ if and .Site.Params.permanentTopNav .Site.Params.stickyNav }}
<header class="sticky">
{{ else }}
<header>
<base href="{{ .Site.BaseURL }}">   <======== Here
{{ end }}
....

Now you can use image in your md file [content/article/my_article.md]:

![Your Image ](img/content/page/about/avatar.png)

Note! Acutal image is located in static folder:

![Your Image ](static/img/content/page/about/avatar.png)

Source: StackOverflow answer

comments powered by Disqus