Organizing generated .md and .svg files

I am new to Hugo. I would like to generate blogposts by weaving Julia code (complete with figures etc), which works like this:

  1. I have my code in a file in content/post, with extension .jmd, eg newpost.jmd,
  2. I run the weaving script (manually via a makefile, since it is time-consuming), which produces newpost.md and various figures of type .svg, in the same directory.

newpost.md would then be processed by Hugo, and it has links to the svg paths. However, with hugo serve, the svg images are not shown, and running hugo build reveals that while the post ends up in public/post/newpost, svg files end up in public/post.

I tried calling the weave script by telling it to put the figures in ../../static/figures. But then the path on the website is figures, so again the paths are wrong.

I am wondering how to organize this. Should I put the source files for weaving in a separate directory? Can paths be fixed manually during processing by Hugo (eg replace figures by something else)?

Have you tried recreating your URL structure in static/images since everything in static is carried over to your rendered site as is?