This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

How to create a custom story tiddler template

6th December 2021 at 4:51pm

Here we show how to add a rule to the Story Tiddler Template Cascade that causes tiddlers tagged to be displayed with a custom appearance incorporating thumbnails of the tiddlers named in the list field.

Open Demo Tiddler List with Custom Story Tiddler Template to see the demo.

First, we add a new step to the story tiddler template cascade. The new filter step is:

[tag[$:/tags/TiddlerList]then[$:/_tw5.com/CustomStoryTiddlerTemplateDemo/Template]]

It can be read as:

If the tiddler has the tag $:/tags/TiddlerList then return $:/_tw5.com/CustomStoryTiddlerTemplateDemo/Template
The template $:/_tw5.com/CustomStoryTiddlerTemplateDemo/Template also depends on styles defined in $:/_tw5.com/CustomStoryTiddlerTemplateDemo/Styles.

The story tiddler template cascade is defined by the tag , so we need to create a configuration tiddler with that tag.

We also need to make sure that it is inserted at the correct point in the cascade:

  • The new rule must be after the "draft" rule to ensure that draft tiddlers with the tag $:/tags/TiddlerList can be edited
  • The new rule must be before the "default" rule otherwise it will never be executed

The control panel "Cascades" tab shows that this can be achieved by inserting the new step immediately before the default step using the list-before field.

The full list of fields in the configuration tiddler is:

$:/_tw5.com/CustomStoryTiddlerTemplateDemo/Filter

code-bodyyes
list-before$:/config/StoryTiddlerTemplateFilters/default
tags$:/tags/StoryTiddlerTemplateFilter
text[tag[$:/tags/TiddlerList]then[$:/_tw5.com/CustomStoryTiddlerTemplateDemo/Template]]

Finally, we need to create the demo tiddler itself:

Demo Tiddler List with Custom Story Tiddler Template

created20211204122107920
filterHelloThere Community GettingStarted Features Reference Plugins Learning
modified20211204131610322
tags$:/tags/TiddlerList
textThis is a demo tiddler with a custom story tiddler template that displays the tiddlers named in the list field as a fan. See [[How to create a custom story tiddler template]] for details.
typetext/vnd.tiddlywiki