How to see assets linked in obsidian using HUGO framework?

I would like to use Obsidian to manage my blog articles written in markdown and see the images and content like a normal note in Obsidian. The problem is that I use HUGO a framework CMS (Content Management System) and to show images the way I know is to put images inside “/static” directory and referred to that without “static” word.

For example: the image sunset.jpg its absolute path inside the Vault is “/static/img/NewZealand-trip/sunset.jpg” but HUGO only reads inside the directory so the path is “/img/NewZealand-trip/sunset.jpg”.

When I open the articles with Obsidian all the images does not appear because the path exclude the main folder “/static”.

How can I view the images with Obsidian? Is there any way to look for a content inside a directory?

The way that I work now is serving the page in local host and see the content on the browser, but I prefer see the images inside Obsidian. With Jekyll I could work fine with Obsidian but with HUGO I can’t see the content because the “static” folder is omitted in the path.

Solution

Here is a solution that I got in the HUGO forum: Help with link images to see from absolute path including "/static"? - support - HUGO

To see images and videos linked in a post with Obsidian and serve as website with HUGO you can link images as an absolute path.

To create an absolute path you need to mount a directory in the root like /assets and reference from static folder (default folder of HUGO).

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

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

Then reference the image in your markdown using an absolute (leading slash) path: ![alt text](/assets/a.jpg)

1 Like

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