Using slug for subdirectory creation

Hi there,
I am trying to use the slug variable for directory creation of my roam files. So, the template I’d like to use is

plain (file “~/Version/bademacs/”)
:if-new (file+head “${slug}/${slug}.org” “#+title: ${title}”)
:unnarrowed t

however, the message is

Use M-x make-directory RET RET to create the directory and its parents

so the directory needs to be created in advance (not practical).
I considered using a function creating the directory and then loading the template file, however I do not know how to access the $slug variable in my function.

How could I proceed?