Reputation: 2582
If I go TiddlyWiki site I can see tab Content. How can I create my own table of content for my tiddlywiki file?
Upvotes: 7
Views: 9932
Reputation: 21
I ended up with a similar solution to the one provided by Andrew which generates the normal Content
page, but I wanted to be able to add the Tag Hide Contents
to any tiddler, so I made the following change to $:/core/ui/ViewTemplate/body
<$list filter="[all[current]!tag[Hide Contents]]">
<div class="tc-table-of-contents">
<<toc-selective-expandable '' sort[created]sort[content-index]>>
</div>
</$list>
With this change, I add the Tag "Hide Contents" to any tiddler I did NOT want to have a drop down indicating its "children". For the main Contents
, I needed to specify the name otherwise it did not work when it was in the sidebar.
The content-index field is my own one that I added to allow me to force the sorting, but I found defaulting to sorting by created date worked most for me.
Upvotes: 0
Reputation: 1
I found the documentation for this really confusing, but here's what I did that works best:
<div class="tc-table-of-contents">
<<toc-selective-expandable 'TableOfContents' sort[ind]>>
</div>
Then, tag each tiddler with TableofContents.
Lastly, when editing each tiddler, add a new field named "ind" (for index - you can change this to whatever you like, so long as it's not being used elsewhere, of course). Assign a value to "ind" starting with 0 to tell it what order you want the tiddlers to go in. I incremented by 10 instead of 1 in case I want to rearrange a few things or insert more in the middle.
Upvotes: 8
Reputation: 130
Create a new tiddler and give the title Contents
Under tags, give the value $:/tags/SideBar
Under type the text for this tiddler, give
<$list filter={{$:/core/Filters/AllTiddlers!!filter}} template="$:/core/ui/ListItemTemplate"/>
Upvotes: 5
Reputation: 61478
This is explained in the documentation.
The short version: Add some tag (e.g. Content
) to the pages you want to appear in the TOC; then in the place where you want it to appear, use one of the macros with that tag name (e.g. <<toc Content>>
). To make a nested TOC, tag pages with the names of tags that appeared at the top level. So for example if you have a tiddler named First
that is tagged with Content
, then you can tag more tiddlers with First
, and they will appear indented below First
in the TOC.
Upvotes: 3