Template-Tiddler as Variable

Hello,

Is there a way to specify the template file “Template-a” centrally in a variable?
I have many calls in a Tiddler following this pattern:

{{Tiddler1||Template-a}}
{{Tiddler2||Template-a}}
{{Tiddler3||Template-a}}

Thank you very much.

You can create a custom procedure eg: _t for template

title: my-procedures
tags: $:/tags/Global
code-body: yes

\procedure _t(tiddler)
\whitespace trim
<$tiddler tiddler=<<tiddler>> > 
<$transclude $tiddler="Template-a" $mode="block"/>
</$tiddler>
\end

To call your procedures it would look like this

<<_t Tiddler1>>
<<_t Tiddler2>>
<<_t Tiddler3>>

Explanation

If you call {{Tiddler1||Template-a}} it is a shortcut for the following code, which is used in the custom procedure.

<$tiddler tiddler="Tiddler1">
<$transclude $tiddler="Tempplate-a" $mode="block"/>
</$tiddler>

The tiddler-widget defines some internal variables and the currentTiddler variable, that can be used by the Template-a

Hope that helps
Mario

Thank you for your prompt reply.

Unfortunately, when I try it out, the command
<<_t Tiddler1>>
only displays the template. The content of Tiddler1 is not displayed for some reason.

The short version {{||}} and the long version work. Perhaps it is a syntax problem?

Update:

Sorry, I’m a bit busy today.
I’ve followed up on everything again. Things are happening :=).

Thank you very much

Perhaps in your use-case, the templated transclusions are interspersed with other content, which you left out for brevity’s sake.

But if the three were really listed sequentially like that, the simplest solution is:

<$list filter="Tiddler1 Tiddler2 Tiddler3">

{{||Template-a}}

</$list>