The currentTiddler

https://tiddlywiki.com/#currentTiddler%20Variable

What do you understand from official doc? Please let to improve it

The currentTiddler variable contains the title of the current tiddler.
Several aspects of WikiText use this tiddler as their context. As a result, within a $list widget or a template tiddler, there is often no need to explicitly specify a tiddler title.
Compare storyTiddler.

If anything, I’d say the difficulty is not about the variable but more about the concept. If you understand the concept then I think the step to understand the variable is small.

So how to explain the concept here?

May be like this:

  • The currentTiddler is the name of variable refers to the tiddler being under focus, you are viewing or editing it.

    • Inside a tiddler one can access the tiddler object using the currentTiddler variable
  • The currentTiddler is also the default name used for $list widget variable

Also user can overwrite the currentTiddler using $tiddler widget, $let, $vars, and $set

Each part can have some examples…

1 Like

About the current tiddler,

As you may know when using the list widget, unless you provide the variable name it defaults to currentTiddler.

It became less mysterious to me, when opening the $:/core/ui/PageTemplate/story we see each and every tiddler is iterated using the following;

<$list filter="[list[$:/StoryList]]" history="$:/HistoryList" template={{$:/config/ui/ViewTemplate}} editTemplate={{$:/config/ui/EditTemplate}} storyview={{$:/view}} emptyMessage={{$:/config/EmptyStoryMessage}}/>

Each tiddler is but a result of a list widget, using the default variable.

Thus with very few exceptions most times I use the currentTiddler variable on the list because;

  • This is what tiddlywiki does
  • Any thing within the list or its template can act on the current tiddler.
  • Most widgets and some core macros use currentTiddler by default
  • Any macros I write are designed to act on the currentTiddler, sometimes with a parameter to override
  • Transclusion uses currentTiddler by default
  • Button’s, common lists and everything else work with currentTiddler

It might be worth mentioning that this is the type of process that occurs within the “Info” display.