Bundled images with markdown syntax in both editor and html

i need to have my markdown files working in “normal” markdown (vscode/obsidian) and rendered a html by HUGO.

BUT there is a problem with standard links to images in bundles. if i have these files:


i need to link the image in ‘mypage.md’ this works in editor but not in Hugo:
![](./image.jpg) or ![](image.jpg)

and this works in Hugo but not in editor

some time ago i remember i was able to make it work with a custom hook image renderer

but today (Hgo 0.94.2) it seems to not work :frowning:

i don’t know how to solve it… doesn’t anybody work with markdown in both ways?
NB: i don’t want to use any shortcode, nor put images in /assets

1 Like

Your current structure, is Not Page Bundle:

├── image.jpg
└── mypage.md

Page bundle, in this case Leaf Bundle, the content file must be named index.md.

├── image.jpg # This image will be treated as Page Bundle Resources
└── index.md

arg… you are right!
i have a _index.md and then several other pages at the same level… i thought they were all page bundles.

this Page Bundles are really complicated (i have hundreads of pages :frowning: and i can’t manage all of them as index.md in named directories…

If you are worried about one-time conversion, it can be done easily with a bash or any language script.

no, it’s not coversion… it’s that i need to keep all notes in a readable way with standard and easy links.
that’s why i don’t want to use many shortcodes

You can have that and also make Hugo builds work. But you’ll need to put in some time to understand the Hugo Module and Mounts features. Here’s a good example by bep: GitHub - bep/portable-hugo-links: A test repo to test out the new Markdown Render Hooks in Hugo 0.62.0

Resources can be in page bundles, yes.

But they can also be in a central assets/ directory (directly or after mounting). That example link I pasted above should help you.

1 Like

yes i know /assets and as is wrote i can’t put all resources there, because each of my books in the /studio directory has to be compacted, with all its images there.

That’s where you use the mounting option. You don’t physically put the files in the assets dir.