How to transclude a subtiddler with template in TiddlyWiki?

Subtiddlers means the individual tiddlers stored within a plugin.

For example, I want to use a subtiddler ($:/boot/boot.js) in my own plugin to force override {{ $:/boot/boot.js ||$:/core/templates/tiddlywiki.js/load-tiddler}} in $:/core/templates/tiddlywiki5.js.

Initially, I thought it would be as simple as using the following code:

<$transclude tiddler="$:/plugins/myplugin" subtiddler="$:/boot/boot.js" template="$:/core/templates/tiddlywiki.js/load-tiddler"/>

However, I discovered that the TranscludeWidget does not have a template attribute and that its implementation relies on the currentTiddler variable. Therefore, this approach is not possible. Are there any other ways to achieve this?

Hi @FSpark it is not possible to transclude a subtiddler through a template.

Rendering an ordinary tiddler through a template is accomplished by setting the currentTiddler variable to the title of the tiddler, and then transcluding the template. Within the template, one can then use constructions like {{!!myfield}} to render a particular field of the tiddler.

The trouble is that there is no way to set currentTiddler to a subtiddler and its containing plugin.

What are you trying to accomplish?

1 Like

Hi @jeremyruston. yes, I realized that so I am looking for other workarounds.

The above problem is what I encountered when developing this plugin:TW5-CSEncryption: Client-Side Encryption for TiddlyWiki5 on Node.js

Although it is solved by abandoning the template and directly hardcoding it, but considering that it is not general enough to use the fields of subtiddler in the future, so I am posting to ask, but it should still be able to reference them through ViewWidget, although there are indeed limitations.