How can I use the variable {{!title}} together with the toc list?

I know I can create a list of the Tiddlers connected by their tags with the following syntax:

<div class="tc-table-of-contents">
<<toc "Root Tag">>
</div>

However, I’d like to substitute Root Tag by the title of my Tiddler. So I’ve tried:

<div class="tc-table-of-contents">
<<toc "{{!!title}}">>
</div>

It doesn’t work though, what am I missing? Why the {{!!title}} variable is not catching the value of the title of my Tiddler in this context?

You can’t substitute text that way into a the macro wikitext (meaning the << ... >> nomenclature.) There’s more than one way around this, but the easiest is probably use the macrocall widget instead:

<div class="tc-table-of-contents">
<$macrocall $name="toc" tag=<<currentTiddler>> />
</div>
3 Likes

This works too:

<div class="tc-table-of-contents">
<$macrocall $name="toc" tag={{!!title}}>>
</div>
2 Likes