TiddlyWiki provides several macros for generating a tree of tiddler links by analysing tags:
toctoc-expandabletoc-selective-expandabletoc-tabbed-internal-nav and toc-tabbed-external-navThe difference between the last two has to do with what happens when the user clicks a link in the right-hand panel:
toc-tabbed-internal-navtoc-tabbed-external-navThe top level of the tree consists of the tiddlers that carry a particular tag, known as the root tag. Tiddlers tagged with any of those make up the next level down, and so on.
At each level, the tiddlers can be ordered by means of the list field of the parent tag tiddler. They can also be ordered by the macro's sort parameter.
The tree displays the caption field of a tiddler if it has one, or the tiddler's title otherwise.
Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a toc-link field with the the value no. In the examples, the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse.
The table of contents is generated as an HTML ordered list. The <ol> elements always have the class tc-toc. Expandable trees have the additional class tc-toc-expandable. Selectively expandable trees (including those in the two-panel browser) have tc-toc-selective-expandable.
To make a table of contents appear in the sidebar, see How to add a new tab to the sidebar.
sort[title]These two parameters are combined into a single filter expression like this:
[tag[$tag$]$sort$]
toc-tabbed-internal-nav and toc-tabbed-external-nav take additional parameters:
$:/temp/toc/selectedTiddler. It is recommended that this be a system tiddler