Obsidian configuration:
{
"attachmentFolderPath": "attachments",
"useMarkdownLinks": true,
"newLinkFormat": "absolute"
}
Hugo configuration:
[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:
attachments/
├── documents/
│ ├── a.pdf
│ └── b.pdf
└── images/
├── kitten-a.jpg
└── kitten-b.jpg
Example:
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
They need to fix that to provide compatibility between Obsidian and VS Code Markdown Preview mode.