More often than not, I prefer short-hand transclusion to macros.
Here’s how I handle what you’re trying to do:
I create a transclusion template tiddler called “YouTube” with the following content:
<iframe width="560" height="315" src={{!!title}} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Take note of src={{!!title}}
Here are two examples of how I use this …
A direct link entered in the text of a tiddler:
{{ https://www.youtube.com/embed/ocFPTl14wtA || YouTube}}
A link retrieved from the field of some tiddler:
{{{ [{Some Tiddler!!youtube}] || YouTube }}}
“Some Tiddler” has a field called “youtube” with the value: https://www.youtube.com/embed/ocFPTl14wtA
You might want to consider putting the common part of URL’s in the template tiddler, and then only refer to the unique parts elsewhere.
So, alternatively: (I prefer this approach)
I create a transclusion template tiddler called “YouTube” with the following content:
<iframe width="560" height="315" src={{{ [<currentTiddler>addprefix[https://www.youtube.com/embed/]] }}} title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Take note of src={{{ [<currentTiddler>addprefix[https://www.youtube.com/embed/]] }}}
Here are two examples of how I use this …
A direct link entered in the text of a tiddler:
{{ ocFPTl14wtA || YouTube}}
A link retrieved from the field of some tiddler:
{{{ [{Some Tiddler!!youtube}] || YouTube }}}
“Some Tiddler” has a field called “youtube” with the value: ocFPTl14wtA